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