1 /* externs.h -- extern function declarations which do not appear in their
4 /* Copyright (C) 1993-2002 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
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
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
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. */
22 /* Make sure that this is included *after* config.h! */
24 #if !defined (_EXTERNS_H_)
29 /* Functions from expr.c. */
30 extern intmax_t evalexp
__P((char *, int *));
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
*));
43 #if defined (COND_COMMAND)
44 extern void xtrace_print_cond_term
__P((int, int, WORD_DESC
*, char *, char *));
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));
53 #if defined (RESTRICTED_SHELL)
54 extern int shell_is_restricted
__P((char *));
55 extern int maybe_make_restricted
__P((char *));
58 extern void unset_bash_input
__P((int));
59 extern void get_current_user_info
__P((void));
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));
66 /* Functions from braces.c. */
67 #if defined (BRACE_EXPANSION)
68 extern char **brace_expand
__P((char *));
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 *));
77 extern char *decode_prompt_string
__P((char *));
79 extern int get_current_prompt_level
__P((void));
80 extern void set_current_prompt_level
__P((int));
83 extern char *history_delimiting_chars
__P((void));
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 *));
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 ();
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));
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));
116 /* Functions from the bash library, lib/sh/libsh.a. These should really
117 go into a separate include file. */
119 /* declarations for functions defined in lib/sh/clktck.c */
120 extern long get_clk_tck
__P((void));
122 /* declarations for functions defined in lib/sh/clock.c */
123 extern void clock_t_to_secs ();
124 extern void print_clock_t ();
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 */
132 extern char *fmtulong
__P((unsigned long int, int, char *, size_t, int));
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));
139 /* Declarations for functions defined in lib/sh/fmtumax.c */
140 extern char *fmtumax
__P((uintmax_t, int, char *, size_t, int));
142 /* Declarations for functions defined in lib/sh/getcwd.c */
143 #if !defined (HAVE_GETCWD)
144 extern char *getcwd
__P((char *, size_t));
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));
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
158 extern char *sh_makepath
__P((const char *, const char *, int));
160 /* declarations for functions defined in lib/sh/netconn.c */
161 extern int isnetconn
__P((int));
163 /* declarations for functions defined in lib/sh/netopen.c */
164 extern int netopen
__P((char *));
166 /* Declarations for functions defined in lib/sh/oslib.c */
168 #if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
169 extern int dup2
__P((int, int));
172 #if !defined (HAVE_GETDTABLESIZE)
173 extern int getdtablesize
__P((void));
174 #endif /* !HAVE_GETDTABLESIZE */
176 #if !defined (HAVE_GETHOSTNAME)
177 extern int gethostname
__P((char *, int));
178 #endif /* !HAVE_GETHOSTNAME */
180 extern int getmaxgroups
__P((void));
181 extern long getmaxchild
__P((void));
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
189 extern char *sh_canonpath
__P((char *, int));
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 *));
195 /* declarations for functions defined in lib/sh/setlinebuf.c */
196 #ifdef NEED_SH_SETLINEBUF_DECL
197 extern int sh_setlinebuf
__P((FILE *));
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 *));
208 /* declarations for functions defined in lib/sh/spell.c */
209 extern int spname
__P((char *, char *));
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 */
217 /* declarations for functions defined in lib/sh/strerror.c */
218 #if !defined (strerror)
219 extern char *strerror
__P((int));
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
*));
227 /* declarations for functions defined in lib/sh/strindex.c */
228 extern char *strindex
__P((const char *, const char *));
230 /* declarations for functions and structures defined in lib/sh/stringlist.c */
232 /* This is a general-purpose argv-style array struct. */
233 typedef struct _list_of_strings
{
239 typedef int sh_strlist_map_func_t
__P((char *));
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
*));
254 /* declarations for functions defined in lib/sh/stringvec.c */
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 **));
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));
270 /* declarations for functions defined in lib/sh/strtod.c */
271 #if !defined (HAVE_STRTOD)
272 extern double strtod
__P((const char *, char **));
275 /* declarations for functions defined in lib/sh/strtol.c */
276 #if !HAVE_DECL_STRTOL
277 extern long strtol
__P((const char *, char **, int));
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));
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));
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));
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));
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));
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 *));
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 ();
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
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 **)); */
326 /* declarations for functions defined in lib/sh/xstrchr.c */
328 extern char *xstrchr
__P((const char *, int));
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));
337 /* declarations for functions defined in lib/sh/zwrite.c */
338 extern int zwrite
__P((int, char *, size_t));
340 #endif /* _EXTERNS_H_ */