Imported from ../bash-2.05b.tar.gz.
[platform/upstream/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-2002 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 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
20    Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
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 extern char *make_command_string __P((COMMAND *));
34 extern void print_command __P((COMMAND *));
35 extern void print_simple_command __P((SIMPLE_COM *));
36 extern char *named_function_string __P((char *, COMMAND *, int));
37 extern void print_word_list __P((WORD_LIST *, char *));
38 extern char *indirection_level_string __P((void));
39 extern void xtrace_print_word_list __P((WORD_LIST *));
40 #if defined (DPAREN_ARITHMETIC)
41 extern void xtrace_print_arith_cmd __P((WORD_LIST *));
42 #endif
43 #if defined (COND_COMMAND)
44 extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *));
45 #endif
46
47 /* Functions from shell.c. */
48 extern void exit_shell __P((int)) __attribute__((__noreturn__));
49 extern void sh_exit __P((int)) __attribute__((__noreturn__));
50 extern void disable_priv_mode __P((void));
51 extern void unbind_args __P((void));
52
53 #if defined (RESTRICTED_SHELL)
54 extern int shell_is_restricted __P((char *));
55 extern int maybe_make_restricted __P((char *));
56 #endif
57
58 extern void unset_bash_input __P((int));
59 extern void get_current_user_info __P((void));
60
61 /* Functions from eval.c. */
62 extern int reader_loop __P((void));
63 extern int parse_command __P((void));
64 extern int read_command __P((void));
65
66 /* Functions from braces.c. */
67 #if defined (BRACE_EXPANSION)
68 extern char **brace_expand __P((char *));
69 #endif
70
71 /* Miscellaneous functions from parse.y */
72 extern int yyparse __P((void));
73 extern int return_EOF __P((void));
74 extern void reset_parser __P((void));
75 extern WORD_LIST *parse_string_to_word_list __P((char *, const char *));
76
77 extern char *decode_prompt_string __P((char *));
78
79 extern int get_current_prompt_level __P((void));
80 extern void set_current_prompt_level __P((int));
81
82 #if defined (HISTORY)
83 extern char *history_delimiting_chars __P((void));
84 #endif
85
86 /* Declarations for functions defined in locale.c */
87 extern void set_default_locale __P((void));
88 extern void set_default_locale_vars __P((void));
89 extern int set_locale_var __P((char *, char *));
90 extern int set_lang __P((char *, char *));
91 extern char *get_locale_var __P((char *));
92 extern char *localetrans __P((char *, int, int *));
93 extern char *mk_msgstr __P((char *, int *));
94 extern char *localeexpand __P((char *, int, int, int, int *));
95
96 /* Declarations for functions defined in list.c. */
97 extern void list_walk __P((GENERIC_LIST *, sh_glist_func_t *));
98 extern void wlist_walk __P((WORD_LIST *, sh_icpfunc_t *));
99 extern GENERIC_LIST *list_reverse ();
100 extern int list_length ();
101 extern GENERIC_LIST *list_append ();
102 extern GENERIC_LIST *list_remove ();
103
104 /* Declarations for functions defined in stringlib.c */
105 extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int));
106 extern char *find_token_in_alist __P((int, STRING_INT_ALIST *, int));
107 extern int find_index_in_alist __P((char *, STRING_INT_ALIST *, int));
108
109 extern char *substring __P((char *, int, int));
110 extern char *strsub __P((char *, char *, char *, int));
111 extern char *strcreplace __P((char *, int, char *, int));
112 extern void strip_leading __P((char *));
113 extern void strip_trailing __P((char *, int, int));
114 extern 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. */
118
119 /* declarations for functions defined in lib/sh/clktck.c */
120 extern long get_clk_tck __P((void));
121
122 /* declarations for functions defined in lib/sh/clock.c */
123 extern void clock_t_to_secs ();
124 extern void print_clock_t ();
125
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
132 extern 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)
136 extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
137 #endif
138
139 /* Declarations for functions defined in lib/sh/fmtumax.c */
140 extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
141
142 /* Declarations for functions defined in lib/sh/getcwd.c */
143 #if !defined (HAVE_GETCWD)
144 extern char *getcwd __P((char *, size_t));
145 #endif
146
147 /* Declarations for functions defined in lib/sh/itos.c */
148 extern char *inttostr __P((intmax_t, char *, size_t));
149 extern char *itos __P((intmax_t));
150 extern char *uinttostr __P((uintmax_t, char *, size_t));
151 extern char *uitos __P((uintmax_t));
152
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
157
158 extern char *sh_makepath __P((const char *, const char *, int));
159
160 /* declarations for functions defined in lib/sh/netconn.c */
161 extern int isnetconn __P((int));
162
163 /* declarations for functions defined in lib/sh/netopen.c */
164 extern int netopen __P((char *));
165
166 /* Declarations for  functions defined in lib/sh/oslib.c */
167
168 #if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
169 extern int dup2 __P((int, int));
170 #endif
171
172 #if !defined (HAVE_GETDTABLESIZE)
173 extern int getdtablesize __P((void));
174 #endif /* !HAVE_GETDTABLESIZE */
175
176 #if !defined (HAVE_GETHOSTNAME)
177 extern int gethostname __P((char *, int));
178 #endif /* !HAVE_GETHOSTNAME */
179
180 extern int getmaxgroups __P((void));
181 extern long getmaxchild __P((void));
182
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
189 extern char *sh_canonpath __P((char *, int));
190
191 /* declarations for functions defined in lib/sh/pathphys.c */
192 extern char *sh_physpath __P((char *, int));
193 extern char *sh_realpath __P((const char *, char *));
194
195 /* declarations for functions defined in lib/sh/setlinebuf.c */
196 #ifdef NEED_SH_SETLINEBUF_DECL
197 extern int sh_setlinebuf __P((FILE *));
198 #endif
199
200 /* declarations for functions defined in lib/sh/shquote.c */
201 extern char *sh_single_quote __P((char *));
202 extern char *sh_double_quote __P((char *));
203 extern char *sh_un_double_quote __P((char *));
204 extern char *sh_backslash_quote __P((char *));
205 extern char *sh_backslash_quote_for_double_quotes __P((char *));
206 extern int sh_contains_shell_metas __P((char *));
207
208 /* declarations for functions defined in lib/sh/spell.c */
209 extern int spname __P((char *, char *));
210
211 /* declarations for functions defined in lib/sh/strcasecmp.c */
212 #if !defined (HAVE_STRCASECMP)
213 extern int strncasecmp __P((const char *, const char *, int));
214 extern 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)
219 extern char *strerror __P((int));
220 #endif
221
222 /* declarations for functions defined in lib/sh/strftime.c */
223 #if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL)
224 extern size_t strftime __P((char *, size_t, const char *, const struct tm *));
225 #endif
226
227 /* declarations for functions defined in lib/sh/strindex.c */
228 extern 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. */
233 typedef struct _list_of_strings {
234   char **list;
235   int list_size;
236   int list_len;
237 } STRINGLIST;
238
239 typedef int sh_strlist_map_func_t __P((char *));
240
241 extern STRINGLIST *strlist_create __P((int));
242 extern STRINGLIST *strlist_resize __P((STRINGLIST *, int));
243 extern void strlist_flush __P((STRINGLIST *));
244 extern void strlist_dispose __P((STRINGLIST *));
245 extern int strlist_remove __P((STRINGLIST *, char *));
246 extern STRINGLIST *strlist_copy __P((STRINGLIST *));
247 extern STRINGLIST *strlist_merge __P((STRINGLIST *, STRINGLIST *));
248 extern STRINGLIST *strlist_append __P((STRINGLIST *, STRINGLIST *));
249 extern STRINGLIST *strlist_prefix_suffix __P((STRINGLIST *, char *, char *));
250 extern void strlist_print __P((STRINGLIST *, char *));
251 extern void strlist_walk __P((STRINGLIST *, sh_strlist_map_func_t *));
252 extern void strlist_sort __P((STRINGLIST *));
253
254 /* declarations for functions defined in lib/sh/stringvec.c */
255
256 extern char **strvec_create __P((int));
257 extern char **strvec_resize __P((char **, int));
258 extern void strvec_flush __P((char **));
259 extern void strvec_dispose __P((char **));
260 extern int strvec_remove __P((char **, char *));
261 extern int strvec_len __P((char **));
262 extern int strvec_search __P((char **, char *));
263 extern char **strvec_copy __P((char **));
264 extern int strvec_strcmp __P((char **, char **));
265 extern void strvec_sort __P((char **));
266
267 extern char **strvec_from_word_list __P((WORD_LIST *, int, int, int *));
268 extern WORD_LIST *strvec_to_word_list __P((char **, int, int));
269
270 /* declarations for functions defined in lib/sh/strtod.c */
271 #if !defined (HAVE_STRTOD)
272 extern double strtod __P((const char *, char **));
273 #endif
274
275 /* declarations for functions defined in lib/sh/strtol.c */
276 #if !HAVE_DECL_STRTOL
277 extern long strtol __P((const char *, char **, int));
278 #endif
279
280 /* declarations for functions defined in lib/sh/strtoll.c */
281 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL
282 extern long long strtoll __P((const char *, char **, int));
283 #endif
284
285 /* declarations for functions defined in lib/sh/strtoul.c */
286 #if !HAVE_DECL_STRTOUL
287 extern unsigned long strtoul __P((const char *, char **, int));
288 #endif
289
290 /* declarations for functions defined in lib/sh/strtoull.c */
291 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL
292 extern unsigned long long strtoull __P((const char *, char **, int));
293 #endif
294
295 /* declarations for functions defined in lib/sh/strimax.c */
296 #if !HAVE_DECL_STRTOIMAX
297 extern 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
302 extern uintmax_t strtoumax __P((const char *, char **, int));
303 #endif
304
305 /* declarations for functions defined in lib/sh/strtrans.c */
306 extern char *ansicstr __P((char *, int, int, int *, int *));
307 extern char *ansic_quote __P((char *, int, int *));
308 extern int ansic_shouldquote __P((const char *));
309 extern char *ansiexpand __P((char *, int, int, int *));
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. */
314 extern void timeval_to_secs ();
315 extern void print_timeval ();
316
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
321
322 extern char *sh_mktmpname __P((char *, int));
323 extern int sh_mktmpfd __P((char *, int, char **));
324 /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
325
326 /* declarations for functions defined in lib/sh/xstrchr.c */
327 #undef xstrchr
328 extern char *xstrchr __P((const char *, int));
329
330 /* declarations for functions defined in lib/sh/zread.c */
331 extern ssize_t zread __P((int, char *, size_t));
332 extern ssize_t zreadintr __P((int, char *, size_t));
333 extern ssize_t zreadc __P((int, char *));
334 extern void zreset __P((void));
335 extern void zsyncfd __P((int));
336
337 /* declarations for functions defined in lib/sh/zwrite.c */
338 extern int zwrite __P((int, char *, size_t));
339
340 #endif /* _EXTERNS_H_ */