]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* common.h -- extern declarations for functions defined in common.c. */ |
2 | ||
495aee44 | 3 | /* Copyright (C) 1993-2010 Free Software Foundation, Inc. |
726f6388 JA |
4 | |
5 | This file is part of GNU Bash, the Bourne Again SHell. | |
6 | ||
3185942a JA |
7 | Bash is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation, either version 3 of the License, or | |
10 | (at your option) any later version. | |
726f6388 | 11 | |
3185942a JA |
12 | Bash is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
726f6388 | 16 | |
3185942a JA |
17 | You should have received a copy of the GNU General Public License |
18 | along with Bash. If not, see <http://www.gnu.org/licenses/>. | |
19 | */ | |
726f6388 JA |
20 | |
21 | #if !defined (__COMMON_H) | |
22 | # define __COMMON_H | |
23 | ||
bb70624e | 24 | #include "stdc.h" |
ccc6cda3 | 25 | |
726f6388 JA |
26 | #define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c) |
27 | ||
d166f048 | 28 | /* Flag values for parse_and_execute () */ |
7117c2d2 JA |
29 | #define SEVAL_NONINT 0x001 |
30 | #define SEVAL_INTERACT 0x002 | |
31 | #define SEVAL_NOHIST 0x004 | |
32 | #define SEVAL_NOFREE 0x008 | |
b80f6443 | 33 | #define SEVAL_RESETLINE 0x010 |
3185942a JA |
34 | #define SEVAL_PARSEONLY 0x020 |
35 | #define SEVAL_NOLONGJMP 0x040 | |
7117c2d2 JA |
36 | |
37 | /* Flags for describe_command, shared between type.def and command.def */ | |
38 | #define CDESC_ALL 0x001 /* type -a */ | |
39 | #define CDESC_SHORTDESC 0x002 /* command -V */ | |
40 | #define CDESC_REUSABLE 0x004 /* command -v */ | |
41 | #define CDESC_TYPE 0x008 /* type -t */ | |
42 | #define CDESC_PATH_ONLY 0x010 /* type -p */ | |
43 | #define CDESC_FORCE_PATH 0x020 /* type -ap or type -P */ | |
44 | #define CDESC_NOFUNCS 0x040 /* type -f */ | |
95732b49 | 45 | #define CDESC_ABSPATH 0x080 /* convert to absolute path, no ./ */ |
7117c2d2 JA |
46 | |
47 | /* Flags for get_job_by_name */ | |
48 | #define JM_PREFIX 0x01 /* prefix of job name */ | |
49 | #define JM_SUBSTRING 0x02 /* substring of job name */ | |
50 | #define JM_EXACT 0x04 /* match job name exactly */ | |
51 | #define JM_STOPPED 0x08 /* match stopped jobs only */ | |
52 | #define JM_FIRSTMATCH 0x10 /* return first matching job */ | |
53 | ||
54 | /* Flags for remember_args and value of changed_dollar_vars */ | |
55 | #define ARGS_NONE 0x0 | |
56 | #define ARGS_INVOC 0x01 | |
57 | #define ARGS_FUNC 0x02 | |
58 | #define ARGS_SETBLTIN 0x04 | |
d166f048 | 59 | |
cce855bc | 60 | /* Functions from common.c */ |
f73dda09 | 61 | extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2))); |
3185942a | 62 | extern void builtin_warning __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2))); |
cce855bc JA |
63 | extern void builtin_usage __P((void)); |
64 | extern void no_args __P((WORD_LIST *)); | |
cce855bc JA |
65 | extern int no_options __P((WORD_LIST *)); |
66 | ||
7117c2d2 JA |
67 | /* common error message functions */ |
68 | extern void sh_needarg __P((char *)); | |
69 | extern void sh_neednumarg __P((char *)); | |
70 | extern void sh_notfound __P((char *)); | |
71 | extern void sh_invalidopt __P((char *)); | |
72 | extern void sh_invalidoptname __P((char *)); | |
73 | extern void sh_invalidid __P((char *)); | |
74 | extern void sh_invalidnum __P((char *)); | |
75 | extern void sh_invalidsig __P((char *)); | |
76 | extern void sh_erange __P((char *, char *)); | |
77 | extern void sh_badpid __P((char *)); | |
78 | extern void sh_badjob __P((char *)); | |
79 | extern void sh_readonly __P((const char *)); | |
80 | extern void sh_nojobs __P((char *)); | |
81 | extern void sh_restricted __P((char *)); | |
b80f6443 | 82 | extern void sh_notbuiltin __P((char *)); |
95732b49 | 83 | extern void sh_wrerror __P((void)); |
17345e5a | 84 | extern void sh_ttyerror __P((int)); |
3185942a | 85 | extern int sh_chkwrite __P((int)); |
7117c2d2 | 86 | |
cce855bc JA |
87 | extern char **make_builtin_argv __P((WORD_LIST *, int *)); |
88 | extern void remember_args __P((WORD_LIST *, int)); | |
89 | ||
cce855bc JA |
90 | extern int dollar_vars_changed __P((void)); |
91 | extern void set_dollar_vars_unchanged __P((void)); | |
92 | extern void set_dollar_vars_changed __P((void)); | |
93 | ||
3185942a | 94 | extern int get_numeric_arg __P((WORD_LIST *, int, intmax_t *)); |
f73dda09 | 95 | extern int get_exitstat __P((WORD_LIST *)); |
cce855bc | 96 | extern int read_octal __P((char *)); |
726f6388 JA |
97 | |
98 | /* Keeps track of the current working directory. */ | |
99 | extern char *the_current_working_directory; | |
cce855bc JA |
100 | extern char *get_working_directory __P((char *)); |
101 | extern void set_working_directory __P((char *)); | |
726f6388 JA |
102 | |
103 | #if defined (JOB_CONTROL) | |
7117c2d2 | 104 | extern int get_job_by_name __P((const char *, int)); |
cce855bc | 105 | extern int get_job_spec __P((WORD_LIST *)); |
726f6388 | 106 | #endif |
cce855bc | 107 | extern int display_signal_list __P((WORD_LIST *, int)); |
726f6388 JA |
108 | |
109 | /* It's OK to declare a function as returning a Function * without | |
110 | providing a definition of what a `Function' is. */ | |
cce855bc | 111 | extern struct builtin *builtin_address_internal __P((char *, int)); |
f73dda09 JA |
112 | extern sh_builtin_func_t *find_shell_builtin __P((char *)); |
113 | extern sh_builtin_func_t *builtin_address __P((char *)); | |
114 | extern sh_builtin_func_t *find_special_builtin __P((char *)); | |
cce855bc | 115 | extern void initialize_shell_builtins __P((void)); |
726f6388 | 116 | |
b80f6443 JA |
117 | /* Functions from exit.def */ |
118 | extern void bash_logout __P((void)); | |
119 | ||
f73dda09 JA |
120 | /* Functions from getopts.def */ |
121 | extern void getopts_reset __P((int)); | |
122 | ||
ccc6cda3 | 123 | /* Functions from set.def */ |
f73dda09 | 124 | extern int minus_o_option_value __P((char *)); |
cce855bc | 125 | extern void list_minus_o_opts __P((int, int)); |
f73dda09 | 126 | extern char **get_minus_o_opts __P((void)); |
cce855bc | 127 | extern int set_minus_o_option __P((int, char *)); |
f73dda09 JA |
128 | |
129 | extern void set_shellopts __P((void)); | |
130 | extern void parse_shellopts __P((char *)); | |
131 | extern void initialize_shell_options __P((int)); | |
132 | ||
cce855bc | 133 | extern void reset_shell_options __P((void)); |
d166f048 JA |
134 | |
135 | /* Functions from shopt.def */ | |
cce855bc | 136 | extern void reset_shopt_options __P((void)); |
bb70624e | 137 | extern char **get_shopt_options __P((void)); |
ccc6cda3 | 138 | |
f73dda09 JA |
139 | extern int shopt_setopt __P((char *, int)); |
140 | extern int shopt_listopt __P((char *, int)); | |
141 | ||
0001803f CR |
142 | extern int set_login_shell __P((char *, int)); |
143 | ||
144 | extern void set_bashopts __P((void)); | |
145 | extern void parse_bashopts __P((char *)); | |
146 | extern void initialize_bashopts __P((int)); | |
f73dda09 | 147 | |
ccc6cda3 | 148 | /* Functions from type.def */ |
7117c2d2 | 149 | extern int describe_command __P((char *, int)); |
ccc6cda3 JA |
150 | |
151 | /* Functions from setattr.def */ | |
cce855bc | 152 | extern int set_or_show_attributes __P((WORD_LIST *, int, int)); |
3185942a | 153 | extern int show_all_var_attributes __P((int, int)); |
cce855bc JA |
154 | extern int show_var_attributes __P((SHELL_VAR *, int, int)); |
155 | extern int show_name_attributes __P((char *, int)); | |
156 | extern void set_var_attribute __P((char *, int, int)); | |
ccc6cda3 JA |
157 | |
158 | /* Functions from pushd.def */ | |
cce855bc | 159 | extern char *get_dirstack_from_string __P((char *)); |
7117c2d2 JA |
160 | extern char *get_dirstack_element __P((intmax_t, int)); |
161 | extern void set_dirstack_element __P((intmax_t, int, char *)); | |
0628567a | 162 | extern WORD_LIST *get_directory_stack __P((int)); |
ccc6cda3 JA |
163 | |
164 | /* Functions from evalstring.c */ | |
f73dda09 | 165 | extern int parse_and_execute __P((char *, const char *, int)); |
cce855bc | 166 | extern void parse_and_execute_cleanup __P((void)); |
3185942a | 167 | extern int parse_string __P((char *, const char *, int, char **)); |
ccc6cda3 JA |
168 | |
169 | /* Functions from evalfile.c */ | |
f73dda09 | 170 | extern int maybe_execute_file __P((const char *, int)); |
b80f6443 | 171 | extern int source_file __P((const char *, int)); |
f73dda09 | 172 | extern int fc_execute_file __P((const char *)); |
726f6388 JA |
173 | |
174 | #endif /* !__COMMON_H */ |