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