]> git.ipfire.org Git - thirdparty/bash.git/blame - externs.h
Bash-4.3 patch 32
[thirdparty/bash.git] / externs.h
CommitLineData
726f6388
JA
1/* externs.h -- extern function declarations which do not appear in their
2 own header file. */
3
495aee44 4/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
726f6388
JA
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
3185942a
JA
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.
726f6388 12
3185942a
JA
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.
726f6388 17
3185942a
JA
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/>.
20*/
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 30extern intmax_t evalexp __P((char *, int *));
726f6388
JA
31
32/* Functions from print_cmd.c. */
3185942a
JA
33#define FUNC_MULTILINE 0x01
34#define FUNC_EXTERNAL 0x02
35
726f6388 36extern char *make_command_string __P((COMMAND *));
b80f6443
JA
37extern char *named_function_string __P((char *, COMMAND *, int));
38
726f6388
JA
39extern void print_command __P((COMMAND *));
40extern void print_simple_command __P((SIMPLE_COM *));
ccc6cda3 41extern void print_word_list __P((WORD_LIST *, char *));
b80f6443
JA
42
43/* debugger support */
44extern void print_for_command_head __P((FOR_COM *));
45#if defined (SELECT_COMMAND)
46extern void print_select_command_head __P((SELECT_COM *));
47#endif
48extern void print_case_command_head __P((CASE_COM *));
49#if defined (DPAREN_ARITHMETIC)
50extern void print_arith_command __P((WORD_LIST *));
51#endif
52#if defined (COND_COMMAND)
53extern void print_cond_command __P((COND_COM *));
54#endif
55
56/* set -x support */
0001803f
CR
57extern void xtrace_init __P((void));
58#ifdef NEED_XTRACE_SET_DECL
59extern void xtrace_set __P((int, FILE *));
60#endif
61extern void xtrace_fdchk __P((int));
62extern void xtrace_reset __P((void));
7117c2d2 63extern char *indirection_level_string __P((void));
b80f6443
JA
64extern void xtrace_print_assignment __P((char *, char *, int, int));
65extern void xtrace_print_word_list __P((WORD_LIST *, int));
66extern void xtrace_print_for_command_head __P((FOR_COM *));
67#if defined (SELECT_COMMAND)
68extern void xtrace_print_select_command_head __P((SELECT_COM *));
69#endif
70extern void xtrace_print_case_command_head __P((CASE_COM *));
cce855bc
JA
71#if defined (DPAREN_ARITHMETIC)
72extern void xtrace_print_arith_cmd __P((WORD_LIST *));
73#endif
74#if defined (COND_COMMAND)
75extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *));
76#endif
726f6388
JA
77
78/* Functions from shell.c. */
f73dda09 79extern void exit_shell __P((int)) __attribute__((__noreturn__));
7117c2d2 80extern void sh_exit __P((int)) __attribute__((__noreturn__));
ac50fbac 81extern void subshell_exit __P((int)) __attribute__((__noreturn__));
ccc6cda3 82extern void disable_priv_mode __P((void));
d166f048 83extern void unbind_args __P((void));
ccc6cda3
JA
84
85#if defined (RESTRICTED_SHELL)
b72432fd 86extern int shell_is_restricted __P((char *));
ccc6cda3
JA
87extern int maybe_make_restricted __P((char *));
88#endif
89
cce855bc 90extern void unset_bash_input __P((int));
d166f048
JA
91extern void get_current_user_info __P((void));
92
ccc6cda3
JA
93/* Functions from eval.c. */
94extern int reader_loop __P((void));
95extern int parse_command __P((void));
96extern int read_command __P((void));
726f6388
JA
97
98/* Functions from braces.c. */
99#if defined (BRACE_EXPANSION)
100extern char **brace_expand __P((char *));
101#endif
102
ccc6cda3 103/* Miscellaneous functions from parse.y */
bb70624e 104extern int yyparse __P((void));
f73dda09 105extern int return_EOF __P((void));
3185942a 106extern char *xparse_dolparen __P((char *, char *, int *, int));
bb70624e 107extern void reset_parser __P((void));
b80f6443
JA
108extern WORD_LIST *parse_string_to_word_list __P((char *, int, const char *));
109
ac50fbac
CR
110extern int parser_in_command_position __P((void));
111
b80f6443 112extern void free_pushed_string_input __P((void));
bb70624e 113
ac50fbac
CR
114extern int parser_expanding_alias __P((void));
115extern void parser_save_alias __P((void));
116extern void parser_restore_alias __P((void));
117
7117c2d2
JA
118extern char *decode_prompt_string __P((char *));
119
bb70624e
JA
120extern int get_current_prompt_level __P((void));
121extern void set_current_prompt_level __P((int));
ccc6cda3 122
f73dda09 123#if defined (HISTORY)
495aee44 124extern char *history_delimiting_chars __P((const char *));
f73dda09 125#endif
ccc6cda3
JA
126
127/* Declarations for functions defined in locale.c */
128extern void set_default_locale __P((void));
129extern void set_default_locale_vars __P((void));
130extern int set_locale_var __P((char *, char *));
131extern int set_lang __P((char *, char *));
0628567a 132extern void set_default_lang __P((void));
ccc6cda3
JA
133extern char *get_locale_var __P((char *));
134extern char *localetrans __P((char *, int, int *));
7117c2d2
JA
135extern char *mk_msgstr __P((char *, int *));
136extern char *localeexpand __P((char *, int, int, int, int *));
ccc6cda3
JA
137
138/* Declarations for functions defined in list.c. */
7117c2d2
JA
139extern void list_walk __P((GENERIC_LIST *, sh_glist_func_t *));
140extern void wlist_walk __P((WORD_LIST *, sh_icpfunc_t *));
141extern GENERIC_LIST *list_reverse ();
ccc6cda3
JA
142extern int list_length ();
143extern GENERIC_LIST *list_append ();
7117c2d2 144extern GENERIC_LIST *list_remove ();
ccc6cda3 145
cce855bc 146/* Declarations for functions defined in stringlib.c */
bb70624e 147extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int));
7117c2d2
JA
148extern char *find_token_in_alist __P((int, STRING_INT_ALIST *, int));
149extern int find_index_in_alist __P((char *, STRING_INT_ALIST *, int));
bb70624e 150
0001803f 151extern char *substring __P((const char *, int, int));
cce855bc 152extern char *strsub __P((char *, char *, char *, int));
bb70624e 153extern char *strcreplace __P((char *, int, char *, int));
cce855bc
JA
154extern void strip_leading __P((char *));
155extern void strip_trailing __P((char *, int, int));
cce855bc
JA
156extern void xbcopy __P((char *, char *, int));
157
b80f6443
JA
158/* Functions from version.c. */
159extern char *shell_version_string __P((void));
160extern void show_shell_version __P((int));
161
cce855bc
JA
162/* Functions from the bash library, lib/sh/libsh.a. These should really
163 go into a separate include file. */
28ef6c31 164
3185942a
JA
165/* declarations for functions defined in lib/sh/casemod.c */
166extern char *sh_modcase __P((const char *, char *, int));
167
168/* Defines for flags argument to sh_modcase. These need to agree with what's
169 in lib/sh/casemode.c */
17345e5a
JA
170#define CASE_LOWER 0x0001
171#define CASE_UPPER 0x0002
172#define CASE_CAPITALIZE 0x0004
173#define CASE_UNCAP 0x0008
174#define CASE_TOGGLE 0x0010
175#define CASE_TOGGLEALL 0x0020
176#define CASE_UPFIRST 0x0040
177#define CASE_LOWFIRST 0x0080
178
179#define CASE_USEWORDS 0x1000
3185942a 180
28ef6c31
JA
181/* declarations for functions defined in lib/sh/clktck.c */
182extern long get_clk_tck __P((void));
183
184/* declarations for functions defined in lib/sh/clock.c */
185extern void clock_t_to_secs ();
186extern void print_clock_t ();
187
495aee44
CR
188/* Declarations for functions defined in lib/sh/dprintf.c */
189#if !defined (HAVE_DPRINTF)
190extern void dprintf __P((int, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
191#endif
3185942a 192
f73dda09
JA
193/* Declarations for functions defined in lib/sh/fmtulong.c */
194#define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */
195#define FL_ADDBASE 0x02 /* add base# prefix to converted value */
196#define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */
197#define FL_UNSIGNED 0x08 /* don't add any sign */
198
199extern char *fmtulong __P((unsigned long int, int, char *, size_t, int));
200
201/* Declarations for functions defined in lib/sh/fmtulong.c */
202#if defined (HAVE_LONG_LONG)
203extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
204#endif
205
7117c2d2
JA
206/* Declarations for functions defined in lib/sh/fmtumax.c */
207extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
208
0001803f
CR
209/* Declarations for functions defined in lib/sh/fnxform.c */
210extern char *fnx_fromfs __P((char *, size_t));
211extern char *fnx_tofs __P((char *, size_t));
212
3185942a 213/* Declarations for functions defined in lib/sh/fpurge.c */
89a92869
CR
214
215#if defined NEED_FPURGE_DECL
3185942a
JA
216#if !HAVE_DECL_FPURGE
217
218#if HAVE_FPURGE
219# define fpurge _bash_fpurge
220#endif
221extern int fpurge __P((FILE *stream));
222
223#endif /* HAVE_DECL_FPURGE */
89a92869 224#endif /* NEED_FPURGE_DECL */
3185942a 225
cce855bc
JA
226/* Declarations for functions defined in lib/sh/getcwd.c */
227#if !defined (HAVE_GETCWD)
228extern char *getcwd __P((char *, size_t));
229#endif
230
3185942a
JA
231/* Declarations for functions defined in lib/sh/input_avail.c */
232extern int input_avail __P((int));
233
cce855bc 234/* Declarations for functions defined in lib/sh/itos.c */
7117c2d2
JA
235extern char *inttostr __P((intmax_t, char *, size_t));
236extern char *itos __P((intmax_t));
ac50fbac 237extern char *mitos __P((intmax_t));
7117c2d2
JA
238extern char *uinttostr __P((uintmax_t, char *, size_t));
239extern char *uitos __P((uintmax_t));
cce855bc 240
28ef6c31
JA
241/* declarations for functions defined in lib/sh/makepath.c */
242#define MP_DOTILDE 0x01
243#define MP_DOCWD 0x02
244#define MP_RMDOT 0x04
3185942a 245#define MP_IGNDOT 0x08
ccc6cda3 246
f73dda09 247extern char *sh_makepath __P((const char *, const char *, int));
ccc6cda3 248
0001803f
CR
249/* declarations for functions defined in lib/sh/mbscasecmp.c */
250#if !defined (HAVE_MBSCASECMP)
251extern char *mbscasecmp __P((const char *, const char *));
252#endif
253
254/* declarations for functions defined in lib/sh/mbschr.c */
255#if !defined (HAVE_MBSCHR)
256extern char *mbschr __P((const char *, int));
257#endif
258
259/* declarations for functions defined in lib/sh/mbscmp.c */
260#if !defined (HAVE_MBSCMP)
261extern char *mbscmp __P((const char *, const char *));
262#endif
263
7117c2d2
JA
264/* declarations for functions defined in lib/sh/netconn.c */
265extern int isnetconn __P((int));
266
28ef6c31
JA
267/* declarations for functions defined in lib/sh/netopen.c */
268extern int netopen __P((char *));
269
270/* Declarations for functions defined in lib/sh/oslib.c */
ccc6cda3 271
7117c2d2 272#if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
ccc6cda3 273extern int dup2 __P((int, int));
7117c2d2 274#endif
726f6388 275
28ef6c31
JA
276#if !defined (HAVE_GETDTABLESIZE)
277extern int getdtablesize __P((void));
278#endif /* !HAVE_GETDTABLESIZE */
279
ccc6cda3
JA
280#if !defined (HAVE_GETHOSTNAME)
281extern int gethostname __P((char *, int));
282#endif /* !HAVE_GETHOSTNAME */
283
7117c2d2
JA
284extern int getmaxgroups __P((void));
285extern long getmaxchild __P((void));
286
28ef6c31
JA
287/* declarations for functions defined in lib/sh/pathcanon.c */
288#define PATH_CHECKDOTDOT 0x0001
289#define PATH_CHECKEXISTS 0x0002
290#define PATH_HARDPATH 0x0004
291#define PATH_NOALLOC 0x0008
292
293extern char *sh_canonpath __P((char *, int));
294
295/* declarations for functions defined in lib/sh/pathphys.c */
296extern char *sh_physpath __P((char *, int));
297extern char *sh_realpath __P((const char *, char *));
ccc6cda3 298
28ef6c31 299/* declarations for functions defined in lib/sh/setlinebuf.c */
f73dda09
JA
300#ifdef NEED_SH_SETLINEBUF_DECL
301extern int sh_setlinebuf __P((FILE *));
ccc6cda3 302#endif
726f6388 303
0628567a
JA
304/* declarations for functions defined in lib/sh/shaccess.c */
305extern int sh_eaccess __P((char *, int));
306
b80f6443
JA
307/* declarations for functions defined in lib/sh/shmatch.c */
308extern int sh_regmatch __P((const char *, const char *, int));
309
310/* defines for flags argument to sh_regmatch. */
311#define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */
312#define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */
313
495aee44
CR
314/* declarations for functions defined in lib/sh/shmbchar.c */
315extern size_t mbstrlen __P((const char *));
316extern char *mbsmbchar __P((const char *));
ac50fbac 317extern int sh_mbsnlen __P((const char *, size_t, int));
495aee44 318
28ef6c31 319/* declarations for functions defined in lib/sh/shquote.c */
495aee44
CR
320extern char *sh_single_quote __P((const char *));
321extern char *sh_double_quote __P((const char *));
95732b49 322extern char *sh_mkdoublequoted __P((const char *, int, int));
28ef6c31 323extern char *sh_un_double_quote __P((char *));
ac50fbac 324extern char *sh_backslash_quote __P((char *, const char *, int));
28ef6c31
JA
325extern char *sh_backslash_quote_for_double_quotes __P((char *));
326extern int sh_contains_shell_metas __P((char *));
2b76266c 327extern int sh_contains_quotes __P((char *));
28ef6c31
JA
328
329/* declarations for functions defined in lib/sh/spell.c */
330extern int spname __P((char *, char *));
3185942a 331extern char *dirspell __P((char *));
28ef6c31
JA
332
333/* declarations for functions defined in lib/sh/strcasecmp.c */
334#if !defined (HAVE_STRCASECMP)
335extern int strncasecmp __P((const char *, const char *, int));
336extern int strcasecmp __P((const char *, const char *));
337#endif /* HAVE_STRCASECMP */
338
0001803f
CR
339/* declarations for functions defined in lib/sh/strcasestr.c */
340#if ! HAVE_STRCASESTR
341extern char *strcasestr __P((const char *, const char *));
342#endif
343
495aee44
CR
344/* declarations for functions defined in lib/sh/strchrnul.c */
345#if ! HAVE_STRCHRNUL
346extern char *strchrnul __P((const char *, int));
347#endif
348
28ef6c31 349/* declarations for functions defined in lib/sh/strerror.c */
0628567a 350#if !defined (HAVE_STRERROR) && !defined (strerror)
28ef6c31
JA
351extern char *strerror __P((int));
352#endif
353
7117c2d2
JA
354/* declarations for functions defined in lib/sh/strftime.c */
355#if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL)
356extern size_t strftime __P((char *, size_t, const char *, const struct tm *));
357#endif
358
28ef6c31
JA
359/* declarations for functions and structures defined in lib/sh/stringlist.c */
360
361/* This is a general-purpose argv-style array struct. */
362typedef struct _list_of_strings {
363 char **list;
364 int list_size;
365 int list_len;
366} STRINGLIST;
367
7117c2d2
JA
368typedef int sh_strlist_map_func_t __P((char *));
369
370extern STRINGLIST *strlist_create __P((int));
371extern STRINGLIST *strlist_resize __P((STRINGLIST *, int));
372extern void strlist_flush __P((STRINGLIST *));
373extern void strlist_dispose __P((STRINGLIST *));
374extern int strlist_remove __P((STRINGLIST *, char *));
375extern STRINGLIST *strlist_copy __P((STRINGLIST *));
376extern STRINGLIST *strlist_merge __P((STRINGLIST *, STRINGLIST *));
377extern STRINGLIST *strlist_append __P((STRINGLIST *, STRINGLIST *));
378extern STRINGLIST *strlist_prefix_suffix __P((STRINGLIST *, char *, char *));
379extern void strlist_print __P((STRINGLIST *, char *));
380extern void strlist_walk __P((STRINGLIST *, sh_strlist_map_func_t *));
381extern void strlist_sort __P((STRINGLIST *));
28ef6c31
JA
382
383/* declarations for functions defined in lib/sh/stringvec.c */
384
7117c2d2
JA
385extern char **strvec_create __P((int));
386extern char **strvec_resize __P((char **, int));
ac50fbac
CR
387extern char **strvec_mcreate __P((int));
388extern char **strvec_mresize __P((char **, int));
7117c2d2
JA
389extern void strvec_flush __P((char **));
390extern void strvec_dispose __P((char **));
391extern int strvec_remove __P((char **, char *));
392extern int strvec_len __P((char **));
393extern int strvec_search __P((char **, char *));
394extern char **strvec_copy __P((char **));
395extern int strvec_strcmp __P((char **, char **));
396extern void strvec_sort __P((char **));
397
398extern char **strvec_from_word_list __P((WORD_LIST *, int, int, int *));
399extern WORD_LIST *strvec_to_word_list __P((char **, int, int));
28ef6c31 400
95732b49
JA
401/* declarations for functions defined in lib/sh/strnlen.c */
402#if !defined (HAVE_STRNLEN)
403extern size_t strnlen __P((const char *, size_t));
404#endif
405
406/* declarations for functions defined in lib/sh/strpbrk.c */
407#if !defined (HAVE_STRPBRK)
408extern char *strpbrk __P((const char *, const char *));
409#endif
410
cce855bc
JA
411/* declarations for functions defined in lib/sh/strtod.c */
412#if !defined (HAVE_STRTOD)
413extern double strtod __P((const char *, char **));
414#endif
ccc6cda3 415
cce855bc 416/* declarations for functions defined in lib/sh/strtol.c */
f73dda09 417#if !HAVE_DECL_STRTOL
cce855bc
JA
418extern long strtol __P((const char *, char **, int));
419#endif
420
f73dda09
JA
421/* declarations for functions defined in lib/sh/strtoll.c */
422#if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL
423extern long long strtoll __P((const char *, char **, int));
424#endif
425
cce855bc 426/* declarations for functions defined in lib/sh/strtoul.c */
f73dda09 427#if !HAVE_DECL_STRTOUL
cce855bc
JA
428extern unsigned long strtoul __P((const char *, char **, int));
429#endif
ccc6cda3 430
f73dda09
JA
431/* declarations for functions defined in lib/sh/strtoull.c */
432#if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL
433extern unsigned long long strtoull __P((const char *, char **, int));
434#endif
435
436/* declarations for functions defined in lib/sh/strimax.c */
f73dda09
JA
437#if !HAVE_DECL_STRTOIMAX
438extern intmax_t strtoimax __P((const char *, char **, int));
439#endif
440
441/* declarations for functions defined in lib/sh/strumax.c */
442#if !HAVE_DECL_STRTOUMAX
443extern uintmax_t strtoumax __P((const char *, char **, int));
444#endif
445
28ef6c31
JA
446/* declarations for functions defined in lib/sh/strtrans.c */
447extern char *ansicstr __P((char *, int, int, int *, int *));
448extern char *ansic_quote __P((char *, int, int *));
f73dda09 449extern int ansic_shouldquote __P((const char *));
7117c2d2 450extern char *ansiexpand __P((char *, int, int, int *));
bb70624e
JA
451
452/* declarations for functions defined in lib/sh/timeval.c. No prototypes
453 so we don't have to count on having a definition of struct timeval in
454 scope when this file is included. */
455extern void timeval_to_secs ();
456extern void print_timeval ();
457
28ef6c31
JA
458/* declarations for functions defined in lib/sh/tmpfile.c */
459#define MT_USETMPDIR 0x0001
460#define MT_READWRITE 0x0002
461#define MT_USERANDOM 0x0004
bb70624e 462
28ef6c31
JA
463extern char *sh_mktmpname __P((char *, int));
464extern int sh_mktmpfd __P((char *, int, char **));
465/* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
bb70624e 466
3185942a
JA
467/* declarations for functions defined in lib/sh/uconvert.c */
468extern int uconvert __P((char *, long *, long *));
469
470/* declarations for functions defined in lib/sh/ufuncs.c */
471extern unsigned int falarm __P((unsigned int, unsigned int));
472extern unsigned int fsleep __P((unsigned int, unsigned int));
473
495aee44
CR
474/* declarations for functions defined in lib/sh/unicode.c */
475extern int u32cconv __P((unsigned long, char *));
ac50fbac
CR
476extern void u32reset __P((void));
477
478/* declarations for functions defined in lib/sh/wcsnwidth.c */
479#if defined (HANDLE_MULTIBYTE)
480extern int wcsnwidth __P((const wchar_t *, size_t, int));
481#endif
495aee44 482
95732b49
JA
483/* declarations for functions defined in lib/sh/winsize.c */
484extern void get_new_window_size __P((int, int *, int *));
485
95732b49
JA
486/* declarations for functions defined in lib/sh/zcatfd.c */
487extern int zcatfd __P((int, int, char *));
488
3185942a
JA
489/* declarations for functions defined in lib/sh/zgetline.c */
490extern ssize_t zgetline __P((int, char **, size_t *, int));
491
492/* declarations for functions defined in lib/sh/zmapfd.c */
493extern int zmapfd __P((int, char **, char *));
494
28ef6c31 495/* declarations for functions defined in lib/sh/zread.c */
f73dda09 496extern ssize_t zread __P((int, char *, size_t));
17345e5a 497extern ssize_t zreadretry __P((int, char *, size_t));
7117c2d2 498extern ssize_t zreadintr __P((int, char *, size_t));
f73dda09 499extern ssize_t zreadc __P((int, char *));
17345e5a 500extern ssize_t zreadcintr __P((int, char *));
ac50fbac 501extern ssize_t zreadn __P((int, char *, size_t));
28ef6c31
JA
502extern void zreset __P((void));
503extern void zsyncfd __P((int));
504
505/* declarations for functions defined in lib/sh/zwrite.c */
f73dda09 506extern int zwrite __P((int, char *, size_t));
bb70624e 507
495aee44
CR
508/* declarations for functions defined in lib/glob/gmisc.c */
509extern int match_pattern_char __P((char *, char *));
510extern int umatchlen __P((char *, size_t));
511
512#if defined (HANDLE_MULTIBYTE)
513extern int match_pattern_wchar __P((wchar_t *, wchar_t *));
514extern int wmatchlen __P((wchar_t *, size_t));
515#endif
516
ccc6cda3 517#endif /* _EXTERNS_H_ */