1 /* externs.h -- extern function declarations which do not appear in their
4 /* Copyright (C) 1993-2009 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 extern intmax_t evalexp
__P((char *, int *));
32 /* Functions from print_cmd.c. */
33 #define FUNC_MULTILINE 0x01
34 #define FUNC_EXTERNAL 0x02
36 extern char *make_command_string
__P((COMMAND
*));
37 extern char *named_function_string
__P((char *, COMMAND
*, int));
39 extern void print_command
__P((COMMAND
*));
40 extern void print_simple_command
__P((SIMPLE_COM
*));
41 extern void print_word_list
__P((WORD_LIST
*, char *));
43 /* debugger support */
44 extern void print_for_command_head
__P((FOR_COM
*));
45 #if defined (SELECT_COMMAND)
46 extern void print_select_command_head
__P((SELECT_COM
*));
48 extern void print_case_command_head
__P((CASE_COM
*));
49 #if defined (DPAREN_ARITHMETIC)
50 extern void print_arith_command
__P((WORD_LIST
*));
52 #if defined (COND_COMMAND)
53 extern void print_cond_command
__P((COND_COM
*));
57 extern char *indirection_level_string
__P((void));
58 extern void xtrace_print_assignment
__P((char *, char *, int, int));
59 extern void xtrace_print_word_list
__P((WORD_LIST
*, int));
60 extern void xtrace_print_for_command_head
__P((FOR_COM
*));
61 #if defined (SELECT_COMMAND)
62 extern void xtrace_print_select_command_head
__P((SELECT_COM
*));
64 extern void xtrace_print_case_command_head
__P((CASE_COM
*));
65 #if defined (DPAREN_ARITHMETIC)
66 extern void xtrace_print_arith_cmd
__P((WORD_LIST
*));
68 #if defined (COND_COMMAND)
69 extern void xtrace_print_cond_term
__P((int, int, WORD_DESC
*, char *, char *));
72 /* Functions from shell.c. */
73 extern void exit_shell
__P((int)) __attribute__((__noreturn__
));
74 extern void sh_exit
__P((int)) __attribute__((__noreturn__
));
75 extern void disable_priv_mode
__P((void));
76 extern void unbind_args
__P((void));
78 #if defined (RESTRICTED_SHELL)
79 extern int shell_is_restricted
__P((char *));
80 extern int maybe_make_restricted
__P((char *));
83 extern void unset_bash_input
__P((int));
84 extern void get_current_user_info
__P((void));
86 /* Functions from eval.c. */
87 extern int reader_loop
__P((void));
88 extern int parse_command
__P((void));
89 extern int read_command
__P((void));
91 /* Functions from braces.c. */
92 #if defined (BRACE_EXPANSION)
93 extern char **brace_expand
__P((char *));
96 /* Miscellaneous functions from parse.y */
97 extern int yyparse
__P((void));
98 extern int return_EOF
__P((void));
99 extern char *xparse_dolparen
__P((char *, char *, int *, int));
100 extern void reset_parser
__P((void));
101 extern WORD_LIST
*parse_string_to_word_list
__P((char *, int, const char *));
103 extern void free_pushed_string_input
__P((void));
105 extern char *decode_prompt_string
__P((char *));
107 extern int get_current_prompt_level
__P((void));
108 extern void set_current_prompt_level
__P((int));
110 #if defined (HISTORY)
111 extern char *history_delimiting_chars
__P((void));
114 /* Declarations for functions defined in locale.c */
115 extern void set_default_locale
__P((void));
116 extern void set_default_locale_vars
__P((void));
117 extern int set_locale_var
__P((char *, char *));
118 extern int set_lang
__P((char *, char *));
119 extern void set_default_lang
__P((void));
120 extern char *get_locale_var
__P((char *));
121 extern char *localetrans
__P((char *, int, int *));
122 extern char *mk_msgstr
__P((char *, int *));
123 extern char *localeexpand
__P((char *, int, int, int, int *));
125 /* Declarations for functions defined in list.c. */
126 extern void list_walk
__P((GENERIC_LIST
*, sh_glist_func_t
*));
127 extern void wlist_walk
__P((WORD_LIST
*, sh_icpfunc_t
*));
128 extern GENERIC_LIST
*list_reverse ();
129 extern int list_length ();
130 extern GENERIC_LIST
*list_append ();
131 extern GENERIC_LIST
*list_remove ();
133 /* Declarations for functions defined in stringlib.c */
134 extern int find_string_in_alist
__P((char *, STRING_INT_ALIST
*, int));
135 extern char *find_token_in_alist
__P((int, STRING_INT_ALIST
*, int));
136 extern int find_index_in_alist
__P((char *, STRING_INT_ALIST
*, int));
138 extern char *substring
__P((char *, int, int));
139 extern char *strsub
__P((char *, char *, char *, int));
140 extern char *strcreplace
__P((char *, int, char *, int));
141 extern void strip_leading
__P((char *));
142 extern void strip_trailing
__P((char *, int, int));
143 extern void xbcopy
__P((char *, char *, int));
145 /* Functions from version.c. */
146 extern char *shell_version_string
__P((void));
147 extern void show_shell_version
__P((int));
149 /* Functions from the bash library, lib/sh/libsh.a. These should really
150 go into a separate include file. */
152 /* declarations for functions defined in lib/sh/casemod.c */
153 extern char *sh_modcase
__P((const char *, char *, int));
155 /* Defines for flags argument to sh_modcase. These need to agree with what's
156 in lib/sh/casemode.c */
157 #define CASE_LOWER 0x01
158 #define CASE_UPPER 0x02
159 #define CASE_CAPITALIZE 0x04
160 #define CASE_UNCAP 0x08
161 #define CASE_TOGGLE 0x10
162 #define CASE_TOGGLEALL 0x20
164 /* declarations for functions defined in lib/sh/clktck.c */
165 extern long get_clk_tck
__P((void));
167 /* declarations for functions defined in lib/sh/clock.c */
168 extern void clock_t_to_secs ();
169 extern void print_clock_t ();
171 /* Declarations for functions defined in lib/sh/fdprintf.c */
172 extern void fdprintf
__P((int, const char *, ...)) __attribute__((__format__ (printf
, 2, 3)));
174 /* Declarations for functions defined in lib/sh/fmtulong.c */
175 #define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */
176 #define FL_ADDBASE 0x02 /* add base# prefix to converted value */
177 #define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */
178 #define FL_UNSIGNED 0x08 /* don't add any sign */
180 extern char *fmtulong
__P((unsigned long int, int, char *, size_t, int));
182 /* Declarations for functions defined in lib/sh/fmtulong.c */
183 #if defined (HAVE_LONG_LONG)
184 extern char *fmtullong
__P((unsigned long long int, int, char *, size_t, int));
187 /* Declarations for functions defined in lib/sh/fmtumax.c */
188 extern char *fmtumax
__P((uintmax_t, int, char *, size_t, int));
190 /* Declarations for functions defined in lib/sh/fpurge.c */
191 #if !HAVE_DECL_FPURGE
194 # define fpurge _bash_fpurge
196 extern int fpurge
__P((FILE *stream
));
198 #endif /* HAVE_DECL_FPURGE */
201 /* Declarations for functions defined in lib/sh/getcwd.c */
202 #if !defined (HAVE_GETCWD)
203 extern char *getcwd
__P((char *, size_t));
206 /* Declarations for functions defined in lib/sh/input_avail.c */
207 extern int input_avail
__P((int));
209 /* Declarations for functions defined in lib/sh/itos.c */
210 extern char *inttostr
__P((intmax_t, char *, size_t));
211 extern char *itos
__P((intmax_t));
212 extern char *uinttostr
__P((uintmax_t, char *, size_t));
213 extern char *uitos
__P((uintmax_t));
215 /* declarations for functions defined in lib/sh/makepath.c */
216 #define MP_DOTILDE 0x01
217 #define MP_DOCWD 0x02
218 #define MP_RMDOT 0x04
219 #define MP_IGNDOT 0x08
221 extern char *sh_makepath
__P((const char *, const char *, int));
223 /* declarations for functions defined in lib/sh/netconn.c */
224 extern int isnetconn
__P((int));
226 /* declarations for functions defined in lib/sh/netopen.c */
227 extern int netopen
__P((char *));
229 /* Declarations for functions defined in lib/sh/oslib.c */
231 #if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
232 extern int dup2
__P((int, int));
235 #if !defined (HAVE_GETDTABLESIZE)
236 extern int getdtablesize
__P((void));
237 #endif /* !HAVE_GETDTABLESIZE */
239 #if !defined (HAVE_GETHOSTNAME)
240 extern int gethostname
__P((char *, int));
241 #endif /* !HAVE_GETHOSTNAME */
243 extern int getmaxgroups
__P((void));
244 extern long getmaxchild
__P((void));
246 /* declarations for functions defined in lib/sh/pathcanon.c */
247 #define PATH_CHECKDOTDOT 0x0001
248 #define PATH_CHECKEXISTS 0x0002
249 #define PATH_HARDPATH 0x0004
250 #define PATH_NOALLOC 0x0008
252 extern char *sh_canonpath
__P((char *, int));
254 /* declarations for functions defined in lib/sh/pathphys.c */
255 extern char *sh_physpath
__P((char *, int));
256 extern char *sh_realpath
__P((const char *, char *));
258 /* declarations for functions defined in lib/sh/setlinebuf.c */
259 #ifdef NEED_SH_SETLINEBUF_DECL
260 extern int sh_setlinebuf
__P((FILE *));
263 /* declarations for functions defined in lib/sh/shaccess.c */
264 extern int sh_eaccess
__P((char *, int));
266 /* declarations for functions defined in lib/sh/shmatch.c */
267 extern int sh_regmatch
__P((const char *, const char *, int));
269 /* defines for flags argument to sh_regmatch. */
270 #define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */
271 #define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */
273 /* declarations for functions defined in lib/sh/shquote.c */
274 extern char *sh_single_quote
__P((char *));
275 extern char *sh_double_quote
__P((char *));
276 extern char *sh_mkdoublequoted
__P((const char *, int, int));
277 extern char *sh_un_double_quote
__P((char *));
278 extern char *sh_backslash_quote
__P((char *));
279 extern char *sh_backslash_quote_for_double_quotes
__P((char *));
280 extern int sh_contains_shell_metas
__P((char *));
282 /* declarations for functions defined in lib/sh/spell.c */
283 extern int spname
__P((char *, char *));
284 extern char *dirspell
__P((char *));
286 /* declarations for functions defined in lib/sh/strcasecmp.c */
287 #if !defined (HAVE_STRCASECMP)
288 extern int strncasecmp
__P((const char *, const char *, int));
289 extern int strcasecmp
__P((const char *, const char *));
290 #endif /* HAVE_STRCASECMP */
292 /* declarations for functions defined in lib/sh/strerror.c */
293 #if !defined (HAVE_STRERROR) && !defined (strerror)
294 extern char *strerror
__P((int));
297 /* declarations for functions defined in lib/sh/strftime.c */
298 #if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL)
299 extern size_t strftime
__P((char *, size_t, const char *, const struct tm
*));
302 /* declarations for functions defined in lib/sh/strindex.c */
303 extern char *strindex
__P((const char *, const char *));
305 /* declarations for functions and structures defined in lib/sh/stringlist.c */
307 /* This is a general-purpose argv-style array struct. */
308 typedef struct _list_of_strings
{
314 typedef int sh_strlist_map_func_t
__P((char *));
316 extern STRINGLIST
*strlist_create
__P((int));
317 extern STRINGLIST
*strlist_resize
__P((STRINGLIST
*, int));
318 extern void strlist_flush
__P((STRINGLIST
*));
319 extern void strlist_dispose
__P((STRINGLIST
*));
320 extern int strlist_remove
__P((STRINGLIST
*, char *));
321 extern STRINGLIST
*strlist_copy
__P((STRINGLIST
*));
322 extern STRINGLIST
*strlist_merge
__P((STRINGLIST
*, STRINGLIST
*));
323 extern STRINGLIST
*strlist_append
__P((STRINGLIST
*, STRINGLIST
*));
324 extern STRINGLIST
*strlist_prefix_suffix
__P((STRINGLIST
*, char *, char *));
325 extern void strlist_print
__P((STRINGLIST
*, char *));
326 extern void strlist_walk
__P((STRINGLIST
*, sh_strlist_map_func_t
*));
327 extern void strlist_sort
__P((STRINGLIST
*));
329 /* declarations for functions defined in lib/sh/stringvec.c */
331 extern char **strvec_create
__P((int));
332 extern char **strvec_resize
__P((char **, int));
333 extern void strvec_flush
__P((char **));
334 extern void strvec_dispose
__P((char **));
335 extern int strvec_remove
__P((char **, char *));
336 extern int strvec_len
__P((char **));
337 extern int strvec_search
__P((char **, char *));
338 extern char **strvec_copy
__P((char **));
339 extern int strvec_strcmp
__P((char **, char **));
340 extern void strvec_sort
__P((char **));
342 extern char **strvec_from_word_list
__P((WORD_LIST
*, int, int, int *));
343 extern WORD_LIST
*strvec_to_word_list
__P((char **, int, int));
345 /* declarations for functions defined in lib/sh/strnlen.c */
346 #if !defined (HAVE_STRNLEN)
347 extern size_t strnlen
__P((const char *, size_t));
350 /* declarations for functions defined in lib/sh/strpbrk.c */
351 #if !defined (HAVE_STRPBRK)
352 extern char *strpbrk
__P((const char *, const char *));
355 /* declarations for functions defined in lib/sh/strtod.c */
356 #if !defined (HAVE_STRTOD)
357 extern double strtod
__P((const char *, char **));
360 /* declarations for functions defined in lib/sh/strtol.c */
361 #if !HAVE_DECL_STRTOL
362 extern long strtol
__P((const char *, char **, int));
365 /* declarations for functions defined in lib/sh/strtoll.c */
366 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL
367 extern long long strtoll
__P((const char *, char **, int));
370 /* declarations for functions defined in lib/sh/strtoul.c */
371 #if !HAVE_DECL_STRTOUL
372 extern unsigned long strtoul
__P((const char *, char **, int));
375 /* declarations for functions defined in lib/sh/strtoull.c */
376 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL
377 extern unsigned long long strtoull
__P((const char *, char **, int));
380 /* declarations for functions defined in lib/sh/strimax.c */
381 #if !HAVE_DECL_STRTOIMAX
382 extern intmax_t strtoimax
__P((const char *, char **, int));
385 /* declarations for functions defined in lib/sh/strumax.c */
386 #if !HAVE_DECL_STRTOUMAX
387 extern uintmax_t strtoumax
__P((const char *, char **, int));
390 /* declarations for functions defined in lib/sh/strtrans.c */
391 extern char *ansicstr
__P((char *, int, int, int *, int *));
392 extern char *ansic_quote
__P((char *, int, int *));
393 extern int ansic_shouldquote
__P((const char *));
394 extern char *ansiexpand
__P((char *, int, int, int *));
396 /* declarations for functions defined in lib/sh/timeval.c. No prototypes
397 so we don't have to count on having a definition of struct timeval in
398 scope when this file is included. */
399 extern void timeval_to_secs ();
400 extern void print_timeval ();
402 /* declarations for functions defined in lib/sh/tmpfile.c */
403 #define MT_USETMPDIR 0x0001
404 #define MT_READWRITE 0x0002
405 #define MT_USERANDOM 0x0004
407 extern char *sh_mktmpname
__P((char *, int));
408 extern int sh_mktmpfd
__P((char *, int, char **));
409 /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
411 /* declarations for functions defined in lib/sh/uconvert.c */
412 extern int uconvert
__P((char *, long *, long *));
414 /* declarations for functions defined in lib/sh/ufuncs.c */
415 extern unsigned int falarm
__P((unsigned int, unsigned int));
416 extern unsigned int fsleep
__P((unsigned int, unsigned int));
418 /* declarations for functions defined in lib/sh/winsize.c */
419 extern void get_new_window_size
__P((int, int *, int *));
421 /* declarations for functions defined in lib/sh/xstrchr.c */
423 extern char *xstrchr
__P((const char *, int));
425 /* declarations for functions defined in lib/sh/zcatfd.c */
426 extern int zcatfd
__P((int, int, char *));
428 /* declarations for functions defined in lib/sh/zgetline.c */
429 extern ssize_t zgetline
__P((int, char **, size_t *, int));
431 /* declarations for functions defined in lib/sh/zmapfd.c */
432 extern int zmapfd
__P((int, char **, char *));
434 /* declarations for functions defined in lib/sh/zread.c */
435 extern ssize_t zread
__P((int, char *, size_t));
436 extern ssize_t zreadintr
__P((int, char *, size_t));
437 extern ssize_t zreadc
__P((int, char *));
438 extern void zreset
__P((void));
439 extern void zsyncfd
__P((int));
441 /* declarations for functions defined in lib/sh/zwrite.c */
442 extern int zwrite
__P((int, char *, size_t));
444 #endif /* _EXTERNS_H_ */