1 /* externs.h -- extern function declarations which do not appear in their
4 /* Copyright (C) 1993 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 long 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 void xtrace_print_word_list __P((WORD_LIST *));
39 #if defined (DPAREN_ARITHMETIC)
40 extern void xtrace_print_arith_cmd __P((WORD_LIST *));
42 #if defined (COND_COMMAND)
43 extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *));
46 /* Functions from shell.c. */
47 extern void exit_shell __P((int)) __attribute__((__noreturn__));
48 extern void disable_priv_mode __P((void));
49 extern void unbind_args __P((void));
51 #if defined (RESTRICTED_SHELL)
52 extern int shell_is_restricted __P((char *));
53 extern int maybe_make_restricted __P((char *));
56 extern void unset_bash_input __P((int));
57 extern void get_current_user_info __P((void));
59 /* Functions from eval.c. */
60 extern int reader_loop __P((void));
61 extern int parse_command __P((void));
62 extern int read_command __P((void));
64 /* Functions from braces.c. */
65 #if defined (BRACE_EXPANSION)
66 extern char **brace_expand __P((char *));
69 /* Miscellaneous functions from parse.y */
70 extern int yyparse __P((void));
71 extern int return_EOF __P((void));
72 extern void reset_parser __P((void));
73 extern WORD_LIST *parse_string_to_word_list __P((char *, const char *));
75 extern int get_current_prompt_level __P((void));
76 extern void set_current_prompt_level __P((int));
79 extern char *history_delimiting_chars __P((void));
82 /* Declarations for functions defined in locale.c */
83 extern void set_default_locale __P((void));
84 extern void set_default_locale_vars __P((void));
85 extern int set_locale_var __P((char *, char *));
86 extern int set_lang __P((char *, char *));
87 extern char *get_locale_var __P((char *));
88 extern char *localetrans __P((char *, int, int *));
90 /* Declarations for functions defined in list.c. */
91 extern void map_over_list __P((GENERIC_LIST *, sh_glist_func_t *));
92 extern void map_over_words __P((WORD_LIST *, sh_icpfunc_t *));
93 extern GENERIC_LIST *reverse_list ();
94 extern int list_length ();
95 extern GENERIC_LIST *list_append ();
96 extern GENERIC_LIST *delete_element ();
98 /* Declarations for functions defined in stringlib.c */
99 extern char **word_list_to_argv __P((WORD_LIST *, int, int, int *));
100 extern WORD_LIST *argv_to_word_list __P((char **, int, int));
102 extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int));
104 extern char *strsub __P((char *, char *, char *, int));
105 extern char *strcreplace __P((char *, int, char *, int));
106 extern void strip_leading __P((char *));
107 extern void strip_trailing __P((char *, int, int));
108 extern void xbcopy __P((char *, char *, int));
110 /* Functions from the bash library, lib/sh/libsh.a. These should really
111 go into a separate include file. */
113 /* declarations for functions defined in lib/sh/clktck.c */
114 extern long get_clk_tck __P((void));
116 /* declarations for functions defined in lib/sh/clock.c */
117 extern void clock_t_to_secs ();
118 extern void print_clock_t ();
120 /* Declarations for functions defined in lib/sh/fmtulong.c */
121 #define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */
122 #define FL_ADDBASE 0x02 /* add base# prefix to converted value */
123 #define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */
124 #define FL_UNSIGNED 0x08 /* don't add any sign */
126 extern char *fmtulong __P((unsigned long int, int, char *, size_t, int));
128 /* Declarations for functions defined in lib/sh/fmtulong.c */
129 #if defined (HAVE_LONG_LONG)
130 extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
133 /* Declarations for functions defined in lib/sh/getcwd.c */
134 #if !defined (HAVE_GETCWD)
135 extern char *getcwd __P((char *, size_t));
138 /* Declarations for functions defined in lib/sh/itos.c */
139 extern char *inttostr __P((long, char *, size_t));
140 extern char *itos __P((long));
141 extern char *uinttostr __P((unsigned long, char *, size_t));
142 extern char *uitos __P((unsigned long));
144 /* declarations for functions defined in lib/sh/makepath.c */
145 #define MP_DOTILDE 0x01
146 #define MP_DOCWD 0x02
147 #define MP_RMDOT 0x04
149 extern char *sh_makepath __P((const char *, const char *, int));
151 /* declarations for functions defined in lib/sh/netopen.c */
152 extern int netopen __P((char *));
154 /* Declarations for functions defined in lib/sh/oslib.c */
156 extern int dup2 __P((int, int));
158 #if !defined (HAVE_GETDTABLESIZE)
159 extern int getdtablesize __P((void));
160 #endif /* !HAVE_GETDTABLESIZE */
162 #if !defined (HAVE_GETHOSTNAME)
163 extern int gethostname __P((char *, int));
164 #endif /* !HAVE_GETHOSTNAME */
166 /* declarations for functions defined in lib/sh/pathcanon.c */
167 #define PATH_CHECKDOTDOT 0x0001
168 #define PATH_CHECKEXISTS 0x0002
169 #define PATH_HARDPATH 0x0004
170 #define PATH_NOALLOC 0x0008
172 extern char *sh_canonpath __P((char *, int));
174 /* declarations for functions defined in lib/sh/pathphys.c */
175 extern char *sh_physpath __P((char *, int));
176 extern char *sh_realpath __P((const char *, char *));
178 /* declarations for functions defined in lib/sh/setlinebuf.c */
179 #ifdef NEED_SH_SETLINEBUF_DECL
180 extern int sh_setlinebuf __P((FILE *));
183 /* declarations for functions defined in lib/sh/shquote.c */
184 extern char *sh_single_quote __P((char *));
185 extern char *sh_double_quote __P((char *));
186 extern char *sh_un_double_quote __P((char *));
187 extern char *sh_backslash_quote __P((char *));
188 extern char *sh_backslash_quote_for_double_quotes __P((char *));
189 extern int sh_contains_shell_metas __P((char *));
191 /* declarations for functions defined in lib/sh/spell.c */
192 extern int spname __P((char *, char *));
194 /* declarations for functions defined in lib/sh/strcasecmp.c */
195 #if !defined (HAVE_STRCASECMP)
196 extern int strncasecmp __P((const char *, const char *, int));
197 extern int strcasecmp __P((const char *, const char *));
198 #endif /* HAVE_STRCASECMP */
200 /* declarations for functions defined in lib/sh/strerror.c */
201 #if !defined (strerror)
202 extern char *strerror __P((int));
205 /* declarations for functions defined in lib/sh/strindex.c */
206 extern char *strindex __P((const char *, const char *));
208 /* declarations for functions and structures defined in lib/sh/stringlist.c */
210 /* This is a general-purpose argv-style array struct. */
211 typedef struct _list_of_strings {
217 extern STRINGLIST *alloc_stringlist __P((int));
218 extern STRINGLIST *realloc_stringlist __P((STRINGLIST *, int));
219 extern void free_stringlist __P((STRINGLIST *));
220 extern STRINGLIST *copy_stringlist __P((STRINGLIST *));
221 extern STRINGLIST *merge_stringlists __P((STRINGLIST *, STRINGLIST *));
222 extern STRINGLIST *append_stringlist __P((STRINGLIST *, STRINGLIST *));
223 extern STRINGLIST *prefix_suffix_stringlist __P((STRINGLIST *, char *, char *));
224 extern void print_stringlist __P((STRINGLIST *, char *));
225 extern void sort_stringlist __P((STRINGLIST *));
227 /* declarations for functions defined in lib/sh/stringvec.c */
229 extern int find_name_in_array __P((char *, char **));
230 extern char **alloc_array __P((int));
231 extern int array_len __P((char **));
232 extern void free_array_members __P((char **));
233 extern void free_array __P((char **));
234 extern char **copy_array __P((char **));
235 extern int qsort_string_compare __P((char **, char **));
236 extern void sort_char_array __P((char **));
238 /* declarations for functions defined in lib/sh/strtod.c */
239 #if !defined (HAVE_STRTOD)
240 extern double strtod __P((const char *, char **));
243 /* declarations for functions defined in lib/sh/strtol.c */
244 #if !HAVE_DECL_STRTOL
245 extern long strtol __P((const char *, char **, int));
248 /* declarations for functions defined in lib/sh/strtoll.c */
249 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL
250 extern long long strtoll __P((const char *, char **, int));
253 /* declarations for functions defined in lib/sh/strtoul.c */
254 #if !HAVE_DECL_STRTOUL
255 extern unsigned long strtoul __P((const char *, char **, int));
258 /* declarations for functions defined in lib/sh/strtoull.c */
259 #if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL
260 extern unsigned long long strtoull __P((const char *, char **, int));
263 /* declarations for functions defined in lib/sh/strimax.c */
264 #ifdef NEED_STRTOIMAX_DECL
266 #if !HAVE_DECL_STRTOIMAX
267 extern intmax_t strtoimax __P((const char *, char **, int));
270 /* declarations for functions defined in lib/sh/strumax.c */
271 #if !HAVE_DECL_STRTOUMAX
272 extern uintmax_t strtoumax __P((const char *, char **, int));
275 #endif /* NEED_STRTOIMAX_DECL */
277 /* declarations for functions defined in lib/sh/strtrans.c */
278 extern char *ansicstr __P((char *, int, int, int *, int *));
279 extern char *ansic_quote __P((char *, int, int *));
280 extern int ansic_shouldquote __P((const char *));
282 /* declarations for functions defined in lib/sh/timeval.c. No prototypes
283 so we don't have to count on having a definition of struct timeval in
284 scope when this file is included. */
285 extern void timeval_to_secs ();
286 extern void print_timeval ();
288 /* declarations for functions defined in lib/sh/tmpfile.c */
289 #define MT_USETMPDIR 0x0001
290 #define MT_READWRITE 0x0002
291 #define MT_USERANDOM 0x0004
293 extern char *sh_mktmpname __P((char *, int));
294 extern int sh_mktmpfd __P((char *, int, char **));
295 /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
297 /* declarations for functions defined in lib/sh/zread.c */
298 extern ssize_t zread __P((int, char *, size_t));
299 extern ssize_t zread1 __P((int, char *, size_t));
300 extern ssize_t zreadc __P((int, char *));
301 extern void zreset __P((void));
302 extern void zsyncfd __P((int));
304 /* declarations for functions defined in lib/sh/zwrite.c */
305 extern int zwrite __P((int, char *, size_t));
307 #endif /* _EXTERNS_H_ */