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