]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* externs.h -- extern function declarations which do not appear in their |
2 | own header file. */ | |
3 | ||
95732b49 | 4 | /* Copyright (C) 1993-2005 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 *)); | |
b80f6443 JA |
34 | extern char *named_function_string __P((char *, COMMAND *, int)); |
35 | ||
726f6388 JA |
36 | extern void print_command __P((COMMAND *)); |
37 | extern void print_simple_command __P((SIMPLE_COM *)); | |
ccc6cda3 | 38 | extern void print_word_list __P((WORD_LIST *, char *)); |
b80f6443 JA |
39 | |
40 | /* debugger support */ | |
41 | extern void print_for_command_head __P((FOR_COM *)); | |
42 | #if defined (SELECT_COMMAND) | |
43 | extern void print_select_command_head __P((SELECT_COM *)); | |
44 | #endif | |
45 | extern void print_case_command_head __P((CASE_COM *)); | |
46 | #if defined (DPAREN_ARITHMETIC) | |
47 | extern void print_arith_command __P((WORD_LIST *)); | |
48 | #endif | |
49 | #if defined (COND_COMMAND) | |
50 | extern void print_cond_command __P((COND_COM *)); | |
51 | #endif | |
52 | ||
53 | /* set -x support */ | |
7117c2d2 | 54 | extern char *indirection_level_string __P((void)); |
b80f6443 JA |
55 | extern void xtrace_print_assignment __P((char *, char *, int, int)); |
56 | extern void xtrace_print_word_list __P((WORD_LIST *, int)); | |
57 | extern void xtrace_print_for_command_head __P((FOR_COM *)); | |
58 | #if defined (SELECT_COMMAND) | |
59 | extern void xtrace_print_select_command_head __P((SELECT_COM *)); | |
60 | #endif | |
61 | extern void xtrace_print_case_command_head __P((CASE_COM *)); | |
cce855bc JA |
62 | #if defined (DPAREN_ARITHMETIC) |
63 | extern void xtrace_print_arith_cmd __P((WORD_LIST *)); | |
64 | #endif | |
65 | #if defined (COND_COMMAND) | |
66 | extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *)); | |
67 | #endif | |
726f6388 JA |
68 | |
69 | /* Functions from shell.c. */ | |
f73dda09 | 70 | extern void exit_shell __P((int)) __attribute__((__noreturn__)); |
7117c2d2 | 71 | extern void sh_exit __P((int)) __attribute__((__noreturn__)); |
ccc6cda3 | 72 | extern void disable_priv_mode __P((void)); |
d166f048 | 73 | extern void unbind_args __P((void)); |
ccc6cda3 JA |
74 | |
75 | #if defined (RESTRICTED_SHELL) | |
b72432fd | 76 | extern int shell_is_restricted __P((char *)); |
ccc6cda3 JA |
77 | extern int maybe_make_restricted __P((char *)); |
78 | #endif | |
79 | ||
cce855bc | 80 | extern void unset_bash_input __P((int)); |
d166f048 JA |
81 | extern void get_current_user_info __P((void)); |
82 | ||
ccc6cda3 JA |
83 | /* Functions from eval.c. */ |
84 | extern int reader_loop __P((void)); | |
85 | extern int parse_command __P((void)); | |
86 | extern int read_command __P((void)); | |
726f6388 JA |
87 | |
88 | /* Functions from braces.c. */ | |
89 | #if defined (BRACE_EXPANSION) | |
90 | extern char **brace_expand __P((char *)); | |
91 | #endif | |
92 | ||
ccc6cda3 | 93 | /* Miscellaneous functions from parse.y */ |
bb70624e | 94 | extern int yyparse __P((void)); |
f73dda09 | 95 | extern int return_EOF __P((void)); |
bb70624e | 96 | extern void reset_parser __P((void)); |
b80f6443 JA |
97 | extern WORD_LIST *parse_string_to_word_list __P((char *, int, const char *)); |
98 | ||
99 | extern void free_pushed_string_input __P((void)); | |
bb70624e | 100 | |
7117c2d2 JA |
101 | extern char *decode_prompt_string __P((char *)); |
102 | ||
bb70624e JA |
103 | extern int get_current_prompt_level __P((void)); |
104 | extern void set_current_prompt_level __P((int)); | |
ccc6cda3 | 105 | |
f73dda09 JA |
106 | #if defined (HISTORY) |
107 | extern char *history_delimiting_chars __P((void)); | |
108 | #endif | |
ccc6cda3 JA |
109 | |
110 | /* Declarations for functions defined in locale.c */ | |
111 | extern void set_default_locale __P((void)); | |
112 | extern void set_default_locale_vars __P((void)); | |
113 | extern int set_locale_var __P((char *, char *)); | |
114 | extern int set_lang __P((char *, char *)); | |
0628567a | 115 | extern void set_default_lang __P((void)); |
ccc6cda3 JA |
116 | extern char *get_locale_var __P((char *)); |
117 | extern char *localetrans __P((char *, int, int *)); | |
7117c2d2 JA |
118 | extern char *mk_msgstr __P((char *, int *)); |
119 | extern char *localeexpand __P((char *, int, int, int, int *)); | |
ccc6cda3 JA |
120 | |
121 | /* Declarations for functions defined in list.c. */ | |
7117c2d2 JA |
122 | extern void list_walk __P((GENERIC_LIST *, sh_glist_func_t *)); |
123 | extern void wlist_walk __P((WORD_LIST *, sh_icpfunc_t *)); | |
124 | extern GENERIC_LIST *list_reverse (); | |
ccc6cda3 JA |
125 | extern int list_length (); |
126 | extern GENERIC_LIST *list_append (); | |
7117c2d2 | 127 | extern GENERIC_LIST *list_remove (); |
ccc6cda3 | 128 | |
cce855bc | 129 | /* Declarations for functions defined in stringlib.c */ |
bb70624e | 130 | extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int)); |
7117c2d2 JA |
131 | extern char *find_token_in_alist __P((int, STRING_INT_ALIST *, int)); |
132 | extern int find_index_in_alist __P((char *, STRING_INT_ALIST *, int)); | |
bb70624e | 133 | |
7117c2d2 | 134 | extern char *substring __P((char *, int, int)); |
cce855bc | 135 | extern char *strsub __P((char *, char *, char *, int)); |
bb70624e | 136 | extern char *strcreplace __P((char *, int, char *, int)); |
cce855bc JA |
137 | extern void strip_leading __P((char *)); |
138 | extern void strip_trailing __P((char *, int, int)); | |
cce855bc JA |
139 | extern void xbcopy __P((char *, char *, int)); |
140 | ||
b80f6443 JA |
141 | /* Functions from version.c. */ |
142 | extern char *shell_version_string __P((void)); | |
143 | extern void show_shell_version __P((int)); | |
144 | ||
cce855bc JA |
145 | /* Functions from the bash library, lib/sh/libsh.a. These should really |
146 | go into a separate include file. */ | |
28ef6c31 JA |
147 | |
148 | /* declarations for functions defined in lib/sh/clktck.c */ | |
149 | extern long get_clk_tck __P((void)); | |
150 | ||
151 | /* declarations for functions defined in lib/sh/clock.c */ | |
152 | extern void clock_t_to_secs (); | |
153 | extern void print_clock_t (); | |
154 | ||
f73dda09 JA |
155 | /* Declarations for functions defined in lib/sh/fmtulong.c */ |
156 | #define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */ | |
157 | #define FL_ADDBASE 0x02 /* add base# prefix to converted value */ | |
158 | #define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */ | |
159 | #define FL_UNSIGNED 0x08 /* don't add any sign */ | |
160 | ||
161 | extern char *fmtulong __P((unsigned long int, int, char *, size_t, int)); | |
162 | ||
163 | /* Declarations for functions defined in lib/sh/fmtulong.c */ | |
164 | #if defined (HAVE_LONG_LONG) | |
165 | extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int)); | |
166 | #endif | |
167 | ||
7117c2d2 JA |
168 | /* Declarations for functions defined in lib/sh/fmtumax.c */ |
169 | extern char *fmtumax __P((uintmax_t, int, char *, size_t, int)); | |
170 | ||
cce855bc JA |
171 | /* Declarations for functions defined in lib/sh/getcwd.c */ |
172 | #if !defined (HAVE_GETCWD) | |
173 | extern char *getcwd __P((char *, size_t)); | |
174 | #endif | |
175 | ||
176 | /* Declarations for functions defined in lib/sh/itos.c */ | |
7117c2d2 JA |
177 | extern char *inttostr __P((intmax_t, char *, size_t)); |
178 | extern char *itos __P((intmax_t)); | |
179 | extern char *uinttostr __P((uintmax_t, char *, size_t)); | |
180 | extern char *uitos __P((uintmax_t)); | |
cce855bc | 181 | |
28ef6c31 JA |
182 | /* declarations for functions defined in lib/sh/makepath.c */ |
183 | #define MP_DOTILDE 0x01 | |
184 | #define MP_DOCWD 0x02 | |
185 | #define MP_RMDOT 0x04 | |
ccc6cda3 | 186 | |
f73dda09 | 187 | extern char *sh_makepath __P((const char *, const char *, int)); |
ccc6cda3 | 188 | |
7117c2d2 JA |
189 | /* declarations for functions defined in lib/sh/netconn.c */ |
190 | extern int isnetconn __P((int)); | |
191 | ||
28ef6c31 JA |
192 | /* declarations for functions defined in lib/sh/netopen.c */ |
193 | extern int netopen __P((char *)); | |
194 | ||
195 | /* Declarations for functions defined in lib/sh/oslib.c */ | |
ccc6cda3 | 196 | |
7117c2d2 | 197 | #if !defined (HAVE_DUP2) || defined (DUP2_BROKEN) |
ccc6cda3 | 198 | extern int dup2 __P((int, int)); |
7117c2d2 | 199 | #endif |
726f6388 | 200 | |
28ef6c31 JA |
201 | #if !defined (HAVE_GETDTABLESIZE) |
202 | extern int getdtablesize __P((void)); | |
203 | #endif /* !HAVE_GETDTABLESIZE */ | |
204 | ||
ccc6cda3 JA |
205 | #if !defined (HAVE_GETHOSTNAME) |
206 | extern int gethostname __P((char *, int)); | |
207 | #endif /* !HAVE_GETHOSTNAME */ | |
208 | ||
7117c2d2 JA |
209 | extern int getmaxgroups __P((void)); |
210 | extern long getmaxchild __P((void)); | |
211 | ||
28ef6c31 JA |
212 | /* declarations for functions defined in lib/sh/pathcanon.c */ |
213 | #define PATH_CHECKDOTDOT 0x0001 | |
214 | #define PATH_CHECKEXISTS 0x0002 | |
215 | #define PATH_HARDPATH 0x0004 | |
216 | #define PATH_NOALLOC 0x0008 | |
217 | ||
218 | extern char *sh_canonpath __P((char *, int)); | |
219 | ||
220 | /* declarations for functions defined in lib/sh/pathphys.c */ | |
221 | extern char *sh_physpath __P((char *, int)); | |
222 | extern char *sh_realpath __P((const char *, char *)); | |
ccc6cda3 | 223 | |
28ef6c31 | 224 | /* declarations for functions defined in lib/sh/setlinebuf.c */ |
f73dda09 JA |
225 | #ifdef NEED_SH_SETLINEBUF_DECL |
226 | extern int sh_setlinebuf __P((FILE *)); | |
ccc6cda3 | 227 | #endif |
726f6388 | 228 | |
0628567a JA |
229 | /* declarations for functions defined in lib/sh/shaccess.c */ |
230 | extern int sh_eaccess __P((char *, int)); | |
231 | ||
b80f6443 JA |
232 | /* declarations for functions defined in lib/sh/shmatch.c */ |
233 | extern int sh_regmatch __P((const char *, const char *, int)); | |
234 | ||
235 | /* defines for flags argument to sh_regmatch. */ | |
236 | #define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */ | |
237 | #define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */ | |
238 | ||
28ef6c31 JA |
239 | /* declarations for functions defined in lib/sh/shquote.c */ |
240 | extern char *sh_single_quote __P((char *)); | |
241 | extern char *sh_double_quote __P((char *)); | |
95732b49 | 242 | extern char *sh_mkdoublequoted __P((const char *, int, int)); |
28ef6c31 JA |
243 | extern char *sh_un_double_quote __P((char *)); |
244 | extern char *sh_backslash_quote __P((char *)); | |
245 | extern char *sh_backslash_quote_for_double_quotes __P((char *)); | |
246 | extern int sh_contains_shell_metas __P((char *)); | |
247 | ||
248 | /* declarations for functions defined in lib/sh/spell.c */ | |
249 | extern int spname __P((char *, char *)); | |
250 | ||
251 | /* declarations for functions defined in lib/sh/strcasecmp.c */ | |
252 | #if !defined (HAVE_STRCASECMP) | |
253 | extern int strncasecmp __P((const char *, const char *, int)); | |
254 | extern int strcasecmp __P((const char *, const char *)); | |
255 | #endif /* HAVE_STRCASECMP */ | |
256 | ||
257 | /* declarations for functions defined in lib/sh/strerror.c */ | |
0628567a | 258 | #if !defined (HAVE_STRERROR) && !defined (strerror) |
28ef6c31 JA |
259 | extern char *strerror __P((int)); |
260 | #endif | |
261 | ||
7117c2d2 JA |
262 | /* declarations for functions defined in lib/sh/strftime.c */ |
263 | #if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL) | |
264 | extern size_t strftime __P((char *, size_t, const char *, const struct tm *)); | |
265 | #endif | |
266 | ||
28ef6c31 JA |
267 | /* declarations for functions defined in lib/sh/strindex.c */ |
268 | extern char *strindex __P((const char *, const char *)); | |
269 | ||
270 | /* declarations for functions and structures defined in lib/sh/stringlist.c */ | |
271 | ||
272 | /* This is a general-purpose argv-style array struct. */ | |
273 | typedef struct _list_of_strings { | |
274 | char **list; | |
275 | int list_size; | |
276 | int list_len; | |
277 | } STRINGLIST; | |
278 | ||
7117c2d2 JA |
279 | typedef int sh_strlist_map_func_t __P((char *)); |
280 | ||
281 | extern STRINGLIST *strlist_create __P((int)); | |
282 | extern STRINGLIST *strlist_resize __P((STRINGLIST *, int)); | |
283 | extern void strlist_flush __P((STRINGLIST *)); | |
284 | extern void strlist_dispose __P((STRINGLIST *)); | |
285 | extern int strlist_remove __P((STRINGLIST *, char *)); | |
286 | extern STRINGLIST *strlist_copy __P((STRINGLIST *)); | |
287 | extern STRINGLIST *strlist_merge __P((STRINGLIST *, STRINGLIST *)); | |
288 | extern STRINGLIST *strlist_append __P((STRINGLIST *, STRINGLIST *)); | |
289 | extern STRINGLIST *strlist_prefix_suffix __P((STRINGLIST *, char *, char *)); | |
290 | extern void strlist_print __P((STRINGLIST *, char *)); | |
291 | extern void strlist_walk __P((STRINGLIST *, sh_strlist_map_func_t *)); | |
292 | extern void strlist_sort __P((STRINGLIST *)); | |
28ef6c31 JA |
293 | |
294 | /* declarations for functions defined in lib/sh/stringvec.c */ | |
295 | ||
7117c2d2 JA |
296 | extern char **strvec_create __P((int)); |
297 | extern char **strvec_resize __P((char **, int)); | |
298 | extern void strvec_flush __P((char **)); | |
299 | extern void strvec_dispose __P((char **)); | |
300 | extern int strvec_remove __P((char **, char *)); | |
301 | extern int strvec_len __P((char **)); | |
302 | extern int strvec_search __P((char **, char *)); | |
303 | extern char **strvec_copy __P((char **)); | |
304 | extern int strvec_strcmp __P((char **, char **)); | |
305 | extern void strvec_sort __P((char **)); | |
306 | ||
307 | extern char **strvec_from_word_list __P((WORD_LIST *, int, int, int *)); | |
308 | extern WORD_LIST *strvec_to_word_list __P((char **, int, int)); | |
28ef6c31 | 309 | |
95732b49 JA |
310 | /* declarations for functions defined in lib/sh/strnlen.c */ |
311 | #if !defined (HAVE_STRNLEN) | |
312 | extern size_t strnlen __P((const char *, size_t)); | |
313 | #endif | |
314 | ||
315 | /* declarations for functions defined in lib/sh/strpbrk.c */ | |
316 | #if !defined (HAVE_STRPBRK) | |
317 | extern char *strpbrk __P((const char *, const char *)); | |
318 | #endif | |
319 | ||
cce855bc JA |
320 | /* declarations for functions defined in lib/sh/strtod.c */ |
321 | #if !defined (HAVE_STRTOD) | |
322 | extern double strtod __P((const char *, char **)); | |
323 | #endif | |
ccc6cda3 | 324 | |
cce855bc | 325 | /* declarations for functions defined in lib/sh/strtol.c */ |
f73dda09 | 326 | #if !HAVE_DECL_STRTOL |
cce855bc JA |
327 | extern long strtol __P((const char *, char **, int)); |
328 | #endif | |
329 | ||
f73dda09 JA |
330 | /* declarations for functions defined in lib/sh/strtoll.c */ |
331 | #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL | |
332 | extern long long strtoll __P((const char *, char **, int)); | |
333 | #endif | |
334 | ||
cce855bc | 335 | /* declarations for functions defined in lib/sh/strtoul.c */ |
f73dda09 | 336 | #if !HAVE_DECL_STRTOUL |
cce855bc JA |
337 | extern unsigned long strtoul __P((const char *, char **, int)); |
338 | #endif | |
ccc6cda3 | 339 | |
f73dda09 JA |
340 | /* declarations for functions defined in lib/sh/strtoull.c */ |
341 | #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL | |
342 | extern unsigned long long strtoull __P((const char *, char **, int)); | |
343 | #endif | |
344 | ||
345 | /* declarations for functions defined in lib/sh/strimax.c */ | |
f73dda09 JA |
346 | #if !HAVE_DECL_STRTOIMAX |
347 | extern intmax_t strtoimax __P((const char *, char **, int)); | |
348 | #endif | |
349 | ||
350 | /* declarations for functions defined in lib/sh/strumax.c */ | |
351 | #if !HAVE_DECL_STRTOUMAX | |
352 | extern uintmax_t strtoumax __P((const char *, char **, int)); | |
353 | #endif | |
354 | ||
28ef6c31 JA |
355 | /* declarations for functions defined in lib/sh/strtrans.c */ |
356 | extern char *ansicstr __P((char *, int, int, int *, int *)); | |
357 | extern char *ansic_quote __P((char *, int, int *)); | |
f73dda09 | 358 | extern int ansic_shouldquote __P((const char *)); |
7117c2d2 | 359 | extern char *ansiexpand __P((char *, int, int, int *)); |
bb70624e JA |
360 | |
361 | /* declarations for functions defined in lib/sh/timeval.c. No prototypes | |
362 | so we don't have to count on having a definition of struct timeval in | |
363 | scope when this file is included. */ | |
364 | extern void timeval_to_secs (); | |
365 | extern void print_timeval (); | |
366 | ||
28ef6c31 JA |
367 | /* declarations for functions defined in lib/sh/tmpfile.c */ |
368 | #define MT_USETMPDIR 0x0001 | |
369 | #define MT_READWRITE 0x0002 | |
370 | #define MT_USERANDOM 0x0004 | |
bb70624e | 371 | |
28ef6c31 JA |
372 | extern char *sh_mktmpname __P((char *, int)); |
373 | extern int sh_mktmpfd __P((char *, int, char **)); | |
374 | /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */ | |
bb70624e | 375 | |
95732b49 JA |
376 | /* declarations for functions defined in lib/sh/winsize.c */ |
377 | extern void get_new_window_size __P((int, int *, int *)); | |
378 | ||
7117c2d2 JA |
379 | /* declarations for functions defined in lib/sh/xstrchr.c */ |
380 | #undef xstrchr | |
381 | extern char *xstrchr __P((const char *, int)); | |
382 | ||
95732b49 JA |
383 | /* declarations for functions defined in lib/sh/zcatfd.c */ |
384 | extern int zcatfd __P((int, int, char *)); | |
385 | ||
28ef6c31 | 386 | /* declarations for functions defined in lib/sh/zread.c */ |
f73dda09 | 387 | extern ssize_t zread __P((int, char *, size_t)); |
7117c2d2 | 388 | extern ssize_t zreadintr __P((int, char *, size_t)); |
f73dda09 | 389 | extern ssize_t zreadc __P((int, char *)); |
28ef6c31 JA |
390 | extern void zreset __P((void)); |
391 | extern void zsyncfd __P((int)); | |
392 | ||
393 | /* declarations for functions defined in lib/sh/zwrite.c */ | |
f73dda09 | 394 | extern int zwrite __P((int, char *, size_t)); |
bb70624e | 395 | |
ccc6cda3 | 396 | #endif /* _EXTERNS_H_ */ |