1 /* externs.h -- extern function declarations which do not appear in their
4 /* Copyright (C) 1993-2010 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
22 /* Make sure that this is included *after* config.h! */
24 #if !defined (_EXTERNS_H_)
29 /* Functions from expr.c. */
30 #define EXP_EXPANDED 0x01
32 extern intmax_t evalexp
__P((char *, int, int *));
34 /* Functions from print_cmd.c. */
35 #define FUNC_MULTILINE 0x01
36 #define FUNC_EXTERNAL 0x02
38 extern char *make_command_string
__P((COMMAND
*));
39 extern char *named_function_string
__P((char *, COMMAND
*, int));
41 extern void print_command
__P((COMMAND
*));
42 extern void print_simple_command
__P((SIMPLE_COM
*));
43 extern void print_word_list
__P((WORD_LIST
*, char *));
45 /* debugger support */
46 extern void print_for_command_head
__P((FOR_COM
*));
47 #if defined (SELECT_COMMAND)
48 extern void print_select_command_head
__P((SELECT_COM
*));
50 extern void print_case_command_head
__P((CASE_COM
*));
51 #if defined (DPAREN_ARITHMETIC)
52 extern void print_arith_command
__P((WORD_LIST
*));
54 #if defined (COND_COMMAND)
55 extern void print_cond_command
__P((COND_COM
*));
59 extern void xtrace_init
__P((void));
60 #ifdef NEED_XTRACE_SET_DECL
61 extern void xtrace_set
__P((int, FILE *));
63 extern void xtrace_fdchk
__P((int));
64 extern void xtrace_reset
__P((void));
65 extern char *indirection_level_string
__P((void));
66 extern void xtrace_print_assignment
__P((char *, char *, int, int));
67 extern void xtrace_print_word_list
__P((WORD_LIST
*, int));
68 extern void xtrace_print_for_command_head
__P((FOR_COM
*));
69 #if defined (SELECT_COMMAND)
70 extern void xtrace_print_select_command_head
__P((SELECT_COM
*));
72 extern void xtrace_print_case_command_head
__P((CASE_COM
*));
73 #if defined (DPAREN_ARITHMETIC)
74 extern void xtrace_print_arith_cmd
__P((WORD_LIST
*));
76 #if defined (COND_COMMAND)
77 extern void xtrace_print_cond_term
__P((int, int, WORD_DESC
*, char *, char *));
80 /* Functions from shell.c. */
81 extern void exit_shell
__P((int)) __attribute__((__noreturn__
));
82 extern void sh_exit
__P((int)) __attribute__((__noreturn__
));
83 extern void subshell_exit
__P((int)) __attribute__((__noreturn__
));
84 extern void disable_priv_mode
__P((void));
85 extern void unbind_args
__P((void));
87 #if defined (RESTRICTED_SHELL)
88 extern int shell_is_restricted
__P((char *));
89 extern int maybe_make_restricted
__P((char *));
92 extern void unset_bash_input
__P((int));
93 extern void get_current_user_info
__P((void));
95 /* Functions from eval.c. */
96 extern int reader_loop
__P((void));
97 extern int pretty_print_loop
__P((void));
98 extern int parse_command
__P((void));
99 extern int read_command
__P((void));
101 /* Functions from braces.c. */
102 #if defined (BRACE_EXPANSION)
103 extern char **brace_expand
__P((char *));
106 /* Miscellaneous functions from parse.y */
107 extern int yyparse
__P((void));
108 extern int return_EOF
__P((void));
109 extern void push_token
__P((int));
110 extern char *xparse_dolparen
__P((char *, char *, int *, int));
111 extern void reset_parser
__P((void));
112 extern void reset_readahead_token
__P((void));
113 extern WORD_LIST
*parse_string_to_word_list
__P((char *, int, const char *));
115 extern int parser_in_command_position
__P((void));
117 extern void free_pushed_string_input
__P((void));
119 extern int parser_expanding_alias
__P((void));
120 extern void parser_save_alias
__P((void));
121 extern void parser_restore_alias
__P((void));
123 extern void clear_shell_input_line
__P((void));
125 extern char *decode_prompt_string
__P((char *));
127 extern int get_current_prompt_level
__P((void));
128 extern void set_current_prompt_level
__P((int));
130 #if defined (HISTORY)
131 extern char *history_delimiting_chars
__P((const char *));
134 /* Declarations for functions defined in locale.c */
135 extern void set_default_locale
__P((void));
136 extern void set_default_locale_vars
__P((void));
137 extern int set_locale_var
__P((char *, char *));
138 extern int set_lang
__P((char *, char *));
139 extern void set_default_lang
__P((void));
140 extern char *get_locale_var
__P((char *));
141 extern char *localetrans
__P((char *, int, int *));
142 extern char *mk_msgstr
__P((char *, int *));
143 extern char *localeexpand
__P((char *, int, int, int, int *));
144 #ifndef locale_decpoint
145 extern int locale_decpoint
__P((void));
148 /* Declarations for functions defined in list.c. */
149 extern void list_walk
__P((GENERIC_LIST
*, sh_glist_func_t
*));
150 extern void wlist_walk
__P((WORD_LIST
*, sh_icpfunc_t
*));
151 extern GENERIC_LIST
*list_reverse ();
152 extern int list_length ();
153 extern GENERIC_LIST
*list_append ();
154 extern GENERIC_LIST
*list_remove ();
156 /* Declarations for functions defined in stringlib.c */
157 extern int find_string_in_alist
__P((char *, STRING_INT_ALIST
*, int));
158 extern char *find_token_in_alist
__P((int, STRING_INT_ALIST
*, int));
159 extern int find_index_in_alist
__P((char *, STRING_INT_ALIST
*, int));
161 extern char *substring
__P((const char *, int, int));
162 extern char *strsub
__P((char *, char *, char *, int));
163 extern char *strcreplace
__P((char *, int, const char *, int));
164 extern void strip_leading
__P((char *));
165 extern void strip_trailing
__P((char *, int, int));
166 extern void xbcopy
__P((char *, char *, int));
168 /* Functions from version.c. */
169 extern char *shell_version_string
__P((void));
170 extern void show_shell_version
__P((int));
172 /* Functions from the bash library, lib/sh/libsh.a. These should really
173 go into a separate include file. */
175 /* declarations for functions defined in lib/sh/casemod.c */
176 extern char *sh_modcase
__P((const char *, char *, int));
178 /* Defines for flags argument to sh_modcase. These need to agree with what's
179 in lib/sh/casemode.c */
180 #define CASE_LOWER 0x0001
181 #define CASE_UPPER 0x0002
182 #define CASE_CAPITALIZE 0x0004
183 #define CASE_UNCAP 0x0008
184 #define CASE_TOGGLE 0x0010
185 #define CASE_TOGGLEALL 0x0020
186 #define CASE_UPFIRST 0x0040
187 #define CASE_LOWFIRST 0x0080
189 #define CASE_USEWORDS 0x1000
191 /* declarations for functions defined in lib/sh/clktck.c */
192 extern long get_clk_tck
__P((void));
194 /* declarations for functions defined in lib/sh/clock.c */
195 extern void clock_t_to_secs ();
196 extern void print_clock_t ();
198 /* Declarations for functions defined in lib/sh/dprintf.c */
199 #if !defined (HAVE_DPRINTF)
200 extern void dprintf
__P((int, const char *, ...)) __attribute__((__format__ (printf
, 2, 3)));
203 /* Declarations for functions defined in lib/sh/fmtulong.c */
204 #define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */
205 #define FL_ADDBASE 0x02 /* add base# prefix to converted value */
206 #define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */
207 #define FL_UNSIGNED 0x08 /* don't add any sign */
209 extern char *fmtulong
__P((unsigned long int, int, char *, size_t, int));
211 /* Declarations for functions defined in lib/sh/fmtulong.c */
212 #if defined (HAVE_LONG_LONG)
213 extern char *fmtullong
__P((unsigned long long int, int, char *, size_t, int));
216 /* Declarations for functions defined in lib/sh/fmtumax.c */
217 extern char *fmtumax
__P((uintmax_t, int, char *, size_t, int));
219 /* Declarations for functions defined in lib/sh/fnxform.c */
220 extern char *fnx_fromfs
__P((char *, size_t));
221 extern char *fnx_tofs
__P((char *, size_t));
223 /* Declarations for functions defined in lib/sh/fpurge.c */
225 #if defined NEED_FPURGE_DECL
226 #if !HAVE_DECL_FPURGE
229 # define fpurge _bash_fpurge
231 extern int fpurge
__P((FILE *stream
));
233 #endif /* HAVE_DECL_FPURGE */
234 #endif /* NEED_FPURGE_DECL */
236 /* Declarations for functions defined in lib/sh/getcwd.c */
237 #if !defined (HAVE_GETCWD)
238 extern char *getcwd
__P((char *, size_t));
241 /* Declarations for functions defined in lib/sh/input_avail.c */
242 extern int input_avail
__P((int));
244 /* Declarations for functions defined in lib/sh/itos.c */
245 extern char *inttostr
__P((intmax_t, char *, size_t));
246 extern char *itos
__P((intmax_t));
247 extern char *mitos
__P((intmax_t));
248 extern char *uinttostr
__P((uintmax_t, char *, size_t));
249 extern char *uitos
__P((uintmax_t));
251 /* declarations for functions defined in lib/sh/makepath.c */
252 #define MP_DOTILDE 0x01
253 #define MP_DOCWD 0x02
254 #define MP_RMDOT 0x04
255 #define MP_IGNDOT 0x08
257 extern char *sh_makepath
__P((const char *, const char *, int));
259 /* declarations for functions defined in lib/sh/mbscasecmp.c */
260 #if !defined (HAVE_MBSCASECMP)
261 extern char *mbscasecmp
__P((const char *, const char *));
264 /* declarations for functions defined in lib/sh/mbschr.c */
265 #if !defined (HAVE_MBSCHR)
266 extern char *mbschr
__P((const char *, int));
269 /* declarations for functions defined in lib/sh/mbscmp.c */
270 #if !defined (HAVE_MBSCMP)
271 extern char *mbscmp
__P((const char *, const char *));
274 /* declarations for functions defined in lib/sh/netconn.c */
275 extern int isnetconn
__P((int));
277 /* declarations for functions defined in lib/sh/netopen.c */
278 extern int netopen
__P((char *));
280 /* Declarations for functions defined in lib/sh/oslib.c */
282 #if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
283 extern int dup2
__P((int, int));
286 #if !defined (HAVE_GETDTABLESIZE)
287 extern int getdtablesize
__P((void));
288 #endif /* !HAVE_GETDTABLESIZE */
290 #if !defined (HAVE_GETHOSTNAME)
291 extern int gethostname
__P((char *, int));
292 #endif /* !HAVE_GETHOSTNAME */
294 extern int getmaxgroups
__P((void));
295 extern long getmaxchild
__P((void));
297 /* declarations for functions defined in lib/sh/pathcanon.c */
298 #define PATH_CHECKDOTDOT 0x0001
299 #define PATH_CHECKEXISTS 0x0002
300 #define PATH_HARDPATH 0x0004
301 #define PATH_NOALLOC 0x0008
303 extern char *sh_canonpath
__P((char *, int));
305 /* declarations for functions defined in lib/sh/pathphys.c */
306 extern char *sh_physpath
__P((char *, int));
307 extern char *sh_realpath
__P((const char *, char *));
309 /* declarations for functions defined in lib/sh/setlinebuf.c */
310 #ifdef NEED_SH_SETLINEBUF_DECL
311 extern int sh_setlinebuf
__P((FILE *));
314 /* declarations for functions defined in lib/sh/shaccess.c */
315 extern int sh_eaccess
__P((const char *, int));
317 /* declarations for functions defined in lib/sh/shmatch.c */
318 extern int sh_regmatch
__P((const char *, const char *, int));
320 /* defines for flags argument to sh_regmatch. */
321 #define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */
322 #define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */
324 /* declarations for functions defined in lib/sh/shmbchar.c */
325 extern size_t mbstrlen
__P((const char *));
326 extern char *mbsmbchar
__P((const char *));
327 extern int sh_mbsnlen
__P((const char *, size_t, int));
329 /* declarations for functions defined in lib/sh/shquote.c */
330 extern char *sh_single_quote
__P((const char *));
331 extern char *sh_double_quote
__P((const char *));
332 extern char *sh_mkdoublequoted
__P((const char *, int, int));
333 extern char *sh_un_double_quote
__P((char *));
334 extern char *sh_backslash_quote
__P((char *, const char *, int));
335 extern char *sh_backslash_quote_for_double_quotes
__P((char *));
336 extern char *sh_quote_reusable
__P((char *, int));
337 extern int sh_contains_shell_metas
__P((const char *));
338 extern int sh_contains_quotes
__P((const char *));
340 /* declarations for functions defined in lib/sh/spell.c */
341 extern int spname
__P((char *, char *));
342 extern char *dirspell
__P((char *));
344 /* declarations for functions defined in lib/sh/strcasecmp.c */
345 #if !defined (HAVE_STRCASECMP)
346 extern int strncasecmp
__P((const char *, const char *, size_t));
347 extern int strcasecmp
__P((const char *, const char *));
348 #endif /* HAVE_STRCASECMP */
350 /* declarations for functions defined in lib/sh/strcasestr.c */
351 #if ! HAVE_STRCASESTR
352 extern char *strcasestr
__P((const char *, const char *));
355 /* declarations for functions defined in lib/sh/strchrnul.c */
357 extern char *strchrnul
__P((const char *, int));
360 /* declarations for functions defined in lib/sh/strerror.c */
361 #if !defined (HAVE_STRERROR) && !defined (strerror)
362 extern char *strerror
__P((int));
365 /* declarations for functions defined in lib/sh/strftime.c */
366 #if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL)
367 extern size_t strftime
__P((char *, size_t, const char *, const struct tm
*));
370 /* declarations for functions and structures defined in lib/sh/stringlist.c */
372 /* This is a general-purpose argv-style array struct. */
373 typedef struct _list_of_strings
{
379 typedef int sh_strlist_map_func_t
__P((char *));
381 extern STRINGLIST
*strlist_create
__P((int));
382 extern STRINGLIST
*strlist_resize
__P((STRINGLIST
*, int));
383 extern void strlist_flush
__P((STRINGLIST
*));
384 extern void strlist_dispose
__P((STRINGLIST
*));
385 extern int strlist_remove
__P((STRINGLIST
*, char *));
386 extern STRINGLIST
*strlist_copy
__P((STRINGLIST
*));
387 extern STRINGLIST
*strlist_merge
__P((STRINGLIST
*, STRINGLIST
*));
388 extern STRINGLIST
*strlist_append
__P((STRINGLIST
*, STRINGLIST
*));
389 extern STRINGLIST
*strlist_prefix_suffix
__P((STRINGLIST
*, char *, char *));
390 extern void strlist_print
__P((STRINGLIST
*, char *));
391 extern void strlist_walk
__P((STRINGLIST
*, sh_strlist_map_func_t
*));
392 extern void strlist_sort
__P((STRINGLIST
*));
394 /* declarations for functions defined in lib/sh/stringvec.c */
396 extern char **strvec_create
__P((int));
397 extern char **strvec_resize
__P((char **, int));
398 extern char **strvec_mcreate
__P((int));
399 extern char **strvec_mresize
__P((char **, int));
400 extern void strvec_flush
__P((char **));
401 extern void strvec_dispose
__P((char **));
402 extern int strvec_remove
__P((char **, char *));
403 extern int strvec_len
__P((char **));
404 extern int strvec_search
__P((char **, char *));
405 extern char **strvec_copy
__P((char **));
406 extern int strvec_strcmp
__P((char **, char **));
407 extern void strvec_sort
__P((char **));
409 extern char **strvec_from_word_list
__P((WORD_LIST
*, int, int, int *));
410 extern WORD_LIST
*strvec_to_word_list
__P((char **, int, int));
412 /* declarations for functions defined in lib/sh/strnlen.c */
413 #if !defined (HAVE_STRNLEN)
414 extern size_t strnlen
__P((const char *, size_t));
417 /* declarations for functions defined in lib/sh/strpbrk.c */
418 #if !defined (HAVE_STRPBRK)
419 extern char *strpbrk
__P((const char *, const char *));
422 /* declarations for functions defined in lib/sh/strtod.c */
423 #if !defined (HAVE_STRTOD)
424 extern double strtod
__P((const char *, char **));
427 /* declarations for functions defined in lib/sh/strtol.c */
428 #if !HAVE_DECL_STRTOL
429 extern long strtol
__P((const char *, char **, int));
432 /* declarations for functions defined in lib/sh/strtoll.c */
433 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL
434 extern long long strtoll
__P((const char *, char **, int));
437 /* declarations for functions defined in lib/sh/strtoul.c */
438 #if !HAVE_DECL_STRTOUL
439 extern unsigned long strtoul
__P((const char *, char **, int));
442 /* declarations for functions defined in lib/sh/strtoull.c */
443 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL
444 extern unsigned long long strtoull
__P((const char *, char **, int));
447 /* declarations for functions defined in lib/sh/strimax.c */
448 #if !HAVE_DECL_STRTOIMAX
449 extern intmax_t strtoimax
__P((const char *, char **, int));
452 /* declarations for functions defined in lib/sh/strumax.c */
453 #if !HAVE_DECL_STRTOUMAX
454 extern uintmax_t strtoumax
__P((const char *, char **, int));
457 /* declarations for functions defined in lib/sh/strtrans.c */
458 extern char *ansicstr
__P((char *, int, int, int *, int *));
459 extern char *ansic_quote
__P((char *, int, int *));
460 extern int ansic_shouldquote
__P((const char *));
461 extern char *ansiexpand
__P((char *, int, int, int *));
463 /* declarations for functions defined in lib/sh/timeval.c. No prototypes
464 so we don't have to count on having a definition of struct timeval in
465 scope when this file is included. */
466 extern void timeval_to_secs ();
467 extern void print_timeval ();
469 /* declarations for functions defined in lib/sh/tmpfile.c */
470 #define MT_USETMPDIR 0x0001
471 #define MT_READWRITE 0x0002
472 #define MT_USERANDOM 0x0004
474 extern char *sh_mktmpname
__P((char *, int));
475 extern int sh_mktmpfd
__P((char *, int, char **));
476 /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
478 /* declarations for functions defined in lib/sh/uconvert.c */
479 extern int uconvert
__P((char *, long *, long *));
481 /* declarations for functions defined in lib/sh/ufuncs.c */
482 extern unsigned int falarm
__P((unsigned int, unsigned int));
483 extern unsigned int fsleep
__P((unsigned int, unsigned int));
485 /* declarations for functions defined in lib/sh/unicode.c */
486 extern int u32cconv
__P((unsigned long, char *));
487 extern void u32reset
__P((void));
489 /* declarations for functions defined in lib/sh/utf8.c */
490 extern char *utf8_mbschr
__P((const char *, int));
491 extern int utf8_mbscmp
__P((const char *, const char *));
492 extern char *utf8_mbsmbchar
__P((const char *));
493 extern int utf8_mbsnlen
__P((const char *, size_t, int));
494 extern int utf8_mblen
__P((const char *, size_t));
495 extern size_t utf8_mbstrlen
__P((const char *));
497 /* declarations for functions defined in lib/sh/wcsnwidth.c */
498 #if defined (HANDLE_MULTIBYTE)
499 extern int wcsnwidth
__P((const wchar_t *, size_t, int));
502 /* declarations for functions defined in lib/sh/winsize.c */
503 extern void get_new_window_size
__P((int, int *, int *));
505 /* declarations for functions defined in lib/sh/zcatfd.c */
506 extern int zcatfd
__P((int, int, char *));
508 /* declarations for functions defined in lib/sh/zgetline.c */
509 extern ssize_t zgetline
__P((int, char **, size_t *, int, int));
511 /* declarations for functions defined in lib/sh/zmapfd.c */
512 extern int zmapfd
__P((int, char **, char *));
514 /* declarations for functions defined in lib/sh/zread.c */
515 extern ssize_t zread
__P((int, char *, size_t));
516 extern ssize_t zreadretry
__P((int, char *, size_t));
517 extern ssize_t zreadintr
__P((int, char *, size_t));
518 extern ssize_t zreadc
__P((int, char *));
519 extern ssize_t zreadcintr
__P((int, char *));
520 extern ssize_t zreadn
__P((int, char *, size_t));
521 extern void zreset
__P((void));
522 extern void zsyncfd
__P((int));
524 /* declarations for functions defined in lib/sh/zwrite.c */
525 extern int zwrite
__P((int, char *, size_t));
527 /* declarations for functions defined in lib/glob/gmisc.c */
528 extern int match_pattern_char
__P((char *, char *, int));
529 extern int umatchlen
__P((char *, size_t));
531 #if defined (HANDLE_MULTIBYTE)
532 extern int match_pattern_wchar
__P((wchar_t *, wchar_t *, int));
533 extern int wmatchlen
__P((wchar_t *, size_t));
536 #endif /* _EXTERNS_H_ */