]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* externs.h -- extern function declarations which do not appear in their |
2 | own header file. */ | |
3 | ||
7117c2d2 | 4 | /* Copyright (C) 1993-2002 Free Software Foundation, Inc. |
726f6388 JA |
5 | |
6 | This file is part of GNU Bash, the Bourne Again SHell. | |
7 | ||
8 | Bash is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 2, or (at your option) any later | |
11 | version. | |
12 | ||
13 | Bash is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License along | |
19 | with Bash; see the file COPYING. If not, write to the Free Software | |
bb70624e | 20 | Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ |
726f6388 JA |
21 | |
22 | /* Make sure that this is included *after* config.h! */ | |
23 | ||
ccc6cda3 JA |
24 | #if !defined (_EXTERNS_H_) |
25 | # define _EXTERNS_H_ | |
726f6388 JA |
26 | |
27 | #include "stdc.h" | |
28 | ||
29 | /* Functions from expr.c. */ | |
7117c2d2 | 30 | extern intmax_t evalexp __P((char *, int *)); |
726f6388 JA |
31 | |
32 | /* Functions from print_cmd.c. */ | |
33 | extern char *make_command_string __P((COMMAND *)); | |
34 | extern void print_command __P((COMMAND *)); | |
35 | extern void print_simple_command __P((SIMPLE_COM *)); | |
36 | extern char *named_function_string __P((char *, COMMAND *, int)); | |
ccc6cda3 | 37 | extern void print_word_list __P((WORD_LIST *, char *)); |
7117c2d2 | 38 | extern char *indirection_level_string __P((void)); |
ccc6cda3 | 39 | extern void xtrace_print_word_list __P((WORD_LIST *)); |
cce855bc JA |
40 | #if defined (DPAREN_ARITHMETIC) |
41 | extern void xtrace_print_arith_cmd __P((WORD_LIST *)); | |
42 | #endif | |
43 | #if defined (COND_COMMAND) | |
44 | extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *)); | |
45 | #endif | |
726f6388 JA |
46 | |
47 | /* Functions from shell.c. */ | |
f73dda09 | 48 | extern void exit_shell __P((int)) __attribute__((__noreturn__)); |
7117c2d2 | 49 | extern void sh_exit __P((int)) __attribute__((__noreturn__)); |
ccc6cda3 | 50 | extern void disable_priv_mode __P((void)); |
d166f048 | 51 | extern void unbind_args __P((void)); |
ccc6cda3 JA |
52 | |
53 | #if defined (RESTRICTED_SHELL) | |
b72432fd | 54 | extern int shell_is_restricted __P((char *)); |
ccc6cda3 JA |
55 | extern int maybe_make_restricted __P((char *)); |
56 | #endif | |
57 | ||
cce855bc | 58 | extern void unset_bash_input __P((int)); |
d166f048 JA |
59 | extern void get_current_user_info __P((void)); |
60 | ||
ccc6cda3 JA |
61 | /* Functions from eval.c. */ |
62 | extern int reader_loop __P((void)); | |
63 | extern int parse_command __P((void)); | |
64 | extern int read_command __P((void)); | |
726f6388 JA |
65 | |
66 | /* Functions from braces.c. */ | |
67 | #if defined (BRACE_EXPANSION) | |
68 | extern char **brace_expand __P((char *)); | |
69 | #endif | |
70 | ||
ccc6cda3 | 71 | /* Miscellaneous functions from parse.y */ |
bb70624e | 72 | extern int yyparse __P((void)); |
f73dda09 | 73 | extern int return_EOF __P((void)); |
bb70624e | 74 | extern void reset_parser __P((void)); |
f73dda09 | 75 | extern WORD_LIST *parse_string_to_word_list __P((char *, const char *)); |
bb70624e | 76 | |
7117c2d2 JA |
77 | extern char *decode_prompt_string __P((char *)); |
78 | ||
bb70624e JA |
79 | extern int get_current_prompt_level __P((void)); |
80 | extern void set_current_prompt_level __P((int)); | |
ccc6cda3 | 81 | |
f73dda09 JA |
82 | #if defined (HISTORY) |
83 | extern char *history_delimiting_chars __P((void)); | |
84 | #endif | |
ccc6cda3 JA |
85 | |
86 | /* Declarations for functions defined in locale.c */ | |
87 | extern void set_default_locale __P((void)); | |
88 | extern void set_default_locale_vars __P((void)); | |
89 | extern int set_locale_var __P((char *, char *)); | |
90 | extern int set_lang __P((char *, char *)); | |
91 | extern char *get_locale_var __P((char *)); | |
92 | extern char *localetrans __P((char *, int, int *)); | |
7117c2d2 JA |
93 | extern char *mk_msgstr __P((char *, int *)); |
94 | extern char *localeexpand __P((char *, int, int, int, int *)); | |
ccc6cda3 JA |
95 | |
96 | /* Declarations for functions defined in list.c. */ | |
7117c2d2 JA |
97 | extern void list_walk __P((GENERIC_LIST *, sh_glist_func_t *)); |
98 | extern void wlist_walk __P((WORD_LIST *, sh_icpfunc_t *)); | |
99 | extern GENERIC_LIST *list_reverse (); | |
ccc6cda3 JA |
100 | extern int list_length (); |
101 | extern GENERIC_LIST *list_append (); | |
7117c2d2 | 102 | extern GENERIC_LIST *list_remove (); |
ccc6cda3 | 103 | |
cce855bc | 104 | /* Declarations for functions defined in stringlib.c */ |
bb70624e | 105 | extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int)); |
7117c2d2 JA |
106 | extern char *find_token_in_alist __P((int, STRING_INT_ALIST *, int)); |
107 | extern int find_index_in_alist __P((char *, STRING_INT_ALIST *, int)); | |
bb70624e | 108 | |
7117c2d2 | 109 | extern char *substring __P((char *, int, int)); |
cce855bc | 110 | extern char *strsub __P((char *, char *, char *, int)); |
bb70624e | 111 | extern char *strcreplace __P((char *, int, char *, int)); |
cce855bc JA |
112 | extern void strip_leading __P((char *)); |
113 | extern void strip_trailing __P((char *, int, int)); | |
cce855bc JA |
114 | extern void xbcopy __P((char *, char *, int)); |
115 | ||
116 | /* Functions from the bash library, lib/sh/libsh.a. These should really | |
117 | go into a separate include file. */ | |
28ef6c31 JA |
118 | |
119 | /* declarations for functions defined in lib/sh/clktck.c */ | |
120 | extern long get_clk_tck __P((void)); | |
121 | ||
122 | /* declarations for functions defined in lib/sh/clock.c */ | |
123 | extern void clock_t_to_secs (); | |
124 | extern void print_clock_t (); | |
125 | ||
f73dda09 JA |
126 | /* Declarations for functions defined in lib/sh/fmtulong.c */ |
127 | #define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */ | |
128 | #define FL_ADDBASE 0x02 /* add base# prefix to converted value */ | |
129 | #define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */ | |
130 | #define FL_UNSIGNED 0x08 /* don't add any sign */ | |
131 | ||
132 | extern char *fmtulong __P((unsigned long int, int, char *, size_t, int)); | |
133 | ||
134 | /* Declarations for functions defined in lib/sh/fmtulong.c */ | |
135 | #if defined (HAVE_LONG_LONG) | |
136 | extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int)); | |
137 | #endif | |
138 | ||
7117c2d2 JA |
139 | /* Declarations for functions defined in lib/sh/fmtumax.c */ |
140 | extern char *fmtumax __P((uintmax_t, int, char *, size_t, int)); | |
141 | ||
cce855bc JA |
142 | /* Declarations for functions defined in lib/sh/getcwd.c */ |
143 | #if !defined (HAVE_GETCWD) | |
144 | extern char *getcwd __P((char *, size_t)); | |
145 | #endif | |
146 | ||
147 | /* Declarations for functions defined in lib/sh/itos.c */ | |
7117c2d2 JA |
148 | extern char *inttostr __P((intmax_t, char *, size_t)); |
149 | extern char *itos __P((intmax_t)); | |
150 | extern char *uinttostr __P((uintmax_t, char *, size_t)); | |
151 | extern char *uitos __P((uintmax_t)); | |
cce855bc | 152 | |
28ef6c31 JA |
153 | /* declarations for functions defined in lib/sh/makepath.c */ |
154 | #define MP_DOTILDE 0x01 | |
155 | #define MP_DOCWD 0x02 | |
156 | #define MP_RMDOT 0x04 | |
ccc6cda3 | 157 | |
f73dda09 | 158 | extern char *sh_makepath __P((const char *, const char *, int)); |
ccc6cda3 | 159 | |
7117c2d2 JA |
160 | /* declarations for functions defined in lib/sh/netconn.c */ |
161 | extern int isnetconn __P((int)); | |
162 | ||
28ef6c31 JA |
163 | /* declarations for functions defined in lib/sh/netopen.c */ |
164 | extern int netopen __P((char *)); | |
165 | ||
166 | /* Declarations for functions defined in lib/sh/oslib.c */ | |
ccc6cda3 | 167 | |
7117c2d2 | 168 | #if !defined (HAVE_DUP2) || defined (DUP2_BROKEN) |
ccc6cda3 | 169 | extern int dup2 __P((int, int)); |
7117c2d2 | 170 | #endif |
726f6388 | 171 | |
28ef6c31 JA |
172 | #if !defined (HAVE_GETDTABLESIZE) |
173 | extern int getdtablesize __P((void)); | |
174 | #endif /* !HAVE_GETDTABLESIZE */ | |
175 | ||
ccc6cda3 JA |
176 | #if !defined (HAVE_GETHOSTNAME) |
177 | extern int gethostname __P((char *, int)); | |
178 | #endif /* !HAVE_GETHOSTNAME */ | |
179 | ||
7117c2d2 JA |
180 | extern int getmaxgroups __P((void)); |
181 | extern long getmaxchild __P((void)); | |
182 | ||
28ef6c31 JA |
183 | /* declarations for functions defined in lib/sh/pathcanon.c */ |
184 | #define PATH_CHECKDOTDOT 0x0001 | |
185 | #define PATH_CHECKEXISTS 0x0002 | |
186 | #define PATH_HARDPATH 0x0004 | |
187 | #define PATH_NOALLOC 0x0008 | |
188 | ||
189 | extern char *sh_canonpath __P((char *, int)); | |
190 | ||
191 | /* declarations for functions defined in lib/sh/pathphys.c */ | |
192 | extern char *sh_physpath __P((char *, int)); | |
193 | extern char *sh_realpath __P((const char *, char *)); | |
ccc6cda3 | 194 | |
28ef6c31 | 195 | /* declarations for functions defined in lib/sh/setlinebuf.c */ |
f73dda09 JA |
196 | #ifdef NEED_SH_SETLINEBUF_DECL |
197 | extern int sh_setlinebuf __P((FILE *)); | |
ccc6cda3 | 198 | #endif |
726f6388 | 199 | |
28ef6c31 JA |
200 | /* declarations for functions defined in lib/sh/shquote.c */ |
201 | extern char *sh_single_quote __P((char *)); | |
202 | extern char *sh_double_quote __P((char *)); | |
203 | extern char *sh_un_double_quote __P((char *)); | |
204 | extern char *sh_backslash_quote __P((char *)); | |
205 | extern char *sh_backslash_quote_for_double_quotes __P((char *)); | |
206 | extern int sh_contains_shell_metas __P((char *)); | |
207 | ||
208 | /* declarations for functions defined in lib/sh/spell.c */ | |
209 | extern int spname __P((char *, char *)); | |
210 | ||
211 | /* declarations for functions defined in lib/sh/strcasecmp.c */ | |
212 | #if !defined (HAVE_STRCASECMP) | |
213 | extern int strncasecmp __P((const char *, const char *, int)); | |
214 | extern int strcasecmp __P((const char *, const char *)); | |
215 | #endif /* HAVE_STRCASECMP */ | |
216 | ||
217 | /* declarations for functions defined in lib/sh/strerror.c */ | |
218 | #if !defined (strerror) | |
219 | extern char *strerror __P((int)); | |
220 | #endif | |
221 | ||
7117c2d2 JA |
222 | /* declarations for functions defined in lib/sh/strftime.c */ |
223 | #if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL) | |
224 | extern size_t strftime __P((char *, size_t, const char *, const struct tm *)); | |
225 | #endif | |
226 | ||
28ef6c31 JA |
227 | /* declarations for functions defined in lib/sh/strindex.c */ |
228 | extern char *strindex __P((const char *, const char *)); | |
229 | ||
230 | /* declarations for functions and structures defined in lib/sh/stringlist.c */ | |
231 | ||
232 | /* This is a general-purpose argv-style array struct. */ | |
233 | typedef struct _list_of_strings { | |
234 | char **list; | |
235 | int list_size; | |
236 | int list_len; | |
237 | } STRINGLIST; | |
238 | ||
7117c2d2 JA |
239 | typedef int sh_strlist_map_func_t __P((char *)); |
240 | ||
241 | extern STRINGLIST *strlist_create __P((int)); | |
242 | extern STRINGLIST *strlist_resize __P((STRINGLIST *, int)); | |
243 | extern void strlist_flush __P((STRINGLIST *)); | |
244 | extern void strlist_dispose __P((STRINGLIST *)); | |
245 | extern int strlist_remove __P((STRINGLIST *, char *)); | |
246 | extern STRINGLIST *strlist_copy __P((STRINGLIST *)); | |
247 | extern STRINGLIST *strlist_merge __P((STRINGLIST *, STRINGLIST *)); | |
248 | extern STRINGLIST *strlist_append __P((STRINGLIST *, STRINGLIST *)); | |
249 | extern STRINGLIST *strlist_prefix_suffix __P((STRINGLIST *, char *, char *)); | |
250 | extern void strlist_print __P((STRINGLIST *, char *)); | |
251 | extern void strlist_walk __P((STRINGLIST *, sh_strlist_map_func_t *)); | |
252 | extern void strlist_sort __P((STRINGLIST *)); | |
28ef6c31 JA |
253 | |
254 | /* declarations for functions defined in lib/sh/stringvec.c */ | |
255 | ||
7117c2d2 JA |
256 | extern char **strvec_create __P((int)); |
257 | extern char **strvec_resize __P((char **, int)); | |
258 | extern void strvec_flush __P((char **)); | |
259 | extern void strvec_dispose __P((char **)); | |
260 | extern int strvec_remove __P((char **, char *)); | |
261 | extern int strvec_len __P((char **)); | |
262 | extern int strvec_search __P((char **, char *)); | |
263 | extern char **strvec_copy __P((char **)); | |
264 | extern int strvec_strcmp __P((char **, char **)); | |
265 | extern void strvec_sort __P((char **)); | |
266 | ||
267 | extern char **strvec_from_word_list __P((WORD_LIST *, int, int, int *)); | |
268 | extern WORD_LIST *strvec_to_word_list __P((char **, int, int)); | |
28ef6c31 | 269 | |
cce855bc JA |
270 | /* declarations for functions defined in lib/sh/strtod.c */ |
271 | #if !defined (HAVE_STRTOD) | |
272 | extern double strtod __P((const char *, char **)); | |
273 | #endif | |
ccc6cda3 | 274 | |
cce855bc | 275 | /* declarations for functions defined in lib/sh/strtol.c */ |
f73dda09 | 276 | #if !HAVE_DECL_STRTOL |
cce855bc JA |
277 | extern long strtol __P((const char *, char **, int)); |
278 | #endif | |
279 | ||
f73dda09 JA |
280 | /* declarations for functions defined in lib/sh/strtoll.c */ |
281 | #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL | |
282 | extern long long strtoll __P((const char *, char **, int)); | |
283 | #endif | |
284 | ||
cce855bc | 285 | /* declarations for functions defined in lib/sh/strtoul.c */ |
f73dda09 | 286 | #if !HAVE_DECL_STRTOUL |
cce855bc JA |
287 | extern unsigned long strtoul __P((const char *, char **, int)); |
288 | #endif | |
ccc6cda3 | 289 | |
f73dda09 JA |
290 | /* declarations for functions defined in lib/sh/strtoull.c */ |
291 | #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL | |
292 | extern unsigned long long strtoull __P((const char *, char **, int)); | |
293 | #endif | |
294 | ||
295 | /* declarations for functions defined in lib/sh/strimax.c */ | |
f73dda09 JA |
296 | #if !HAVE_DECL_STRTOIMAX |
297 | extern intmax_t strtoimax __P((const char *, char **, int)); | |
298 | #endif | |
299 | ||
300 | /* declarations for functions defined in lib/sh/strumax.c */ | |
301 | #if !HAVE_DECL_STRTOUMAX | |
302 | extern uintmax_t strtoumax __P((const char *, char **, int)); | |
303 | #endif | |
304 | ||
28ef6c31 JA |
305 | /* declarations for functions defined in lib/sh/strtrans.c */ |
306 | extern char *ansicstr __P((char *, int, int, int *, int *)); | |
307 | extern char *ansic_quote __P((char *, int, int *)); | |
f73dda09 | 308 | extern int ansic_shouldquote __P((const char *)); |
7117c2d2 | 309 | extern char *ansiexpand __P((char *, int, int, int *)); |
bb70624e JA |
310 | |
311 | /* declarations for functions defined in lib/sh/timeval.c. No prototypes | |
312 | so we don't have to count on having a definition of struct timeval in | |
313 | scope when this file is included. */ | |
314 | extern void timeval_to_secs (); | |
315 | extern void print_timeval (); | |
316 | ||
28ef6c31 JA |
317 | /* declarations for functions defined in lib/sh/tmpfile.c */ |
318 | #define MT_USETMPDIR 0x0001 | |
319 | #define MT_READWRITE 0x0002 | |
320 | #define MT_USERANDOM 0x0004 | |
bb70624e | 321 | |
28ef6c31 JA |
322 | extern char *sh_mktmpname __P((char *, int)); |
323 | extern int sh_mktmpfd __P((char *, int, char **)); | |
324 | /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */ | |
bb70624e | 325 | |
7117c2d2 JA |
326 | /* declarations for functions defined in lib/sh/xstrchr.c */ |
327 | #undef xstrchr | |
328 | extern char *xstrchr __P((const char *, int)); | |
329 | ||
28ef6c31 | 330 | /* declarations for functions defined in lib/sh/zread.c */ |
f73dda09 | 331 | extern ssize_t zread __P((int, char *, size_t)); |
7117c2d2 | 332 | extern ssize_t zreadintr __P((int, char *, size_t)); |
f73dda09 | 333 | extern ssize_t zreadc __P((int, char *)); |
28ef6c31 JA |
334 | extern void zreset __P((void)); |
335 | extern void zsyncfd __P((int)); | |
336 | ||
337 | /* declarations for functions defined in lib/sh/zwrite.c */ | |
f73dda09 | 338 | extern int zwrite __P((int, char *, size_t)); |
bb70624e | 339 | |
ccc6cda3 | 340 | #endif /* _EXTERNS_H_ */ |