Imported from ../bash-2.05.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 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 long 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 void xtrace_print_word_list __P((WORD_LIST *));
39 #if defined (DPAREN_ARITHMETIC)
40 extern void xtrace_print_arith_cmd __P((WORD_LIST *));
41 #endif
42 #if defined (COND_COMMAND)
43 extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *));
44 #endif
45
46 /* Functions from shell.c. */
47 extern void exit_shell __P((int));
48 extern void disable_priv_mode __P((void));
49 extern void unbind_args __P((void));
50
51 #if defined (RESTRICTED_SHELL)
52 extern int shell_is_restricted __P((char *));
53 extern int maybe_make_restricted __P((char *));
54 #endif
55
56 extern void unset_bash_input __P((int));
57 extern void get_current_user_info __P((void));
58
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));
63
64 /* Functions from braces.c. */
65 #if defined (BRACE_EXPANSION)
66 extern char **brace_expand __P((char *));
67 #endif
68
69 /* Miscellaneous functions from parse.y */
70 extern int yyparse __P((void));
71 extern void reset_parser __P((void));
72 extern WORD_LIST *parse_string_to_word_list __P((char *, char *));
73
74 extern int get_current_prompt_level __P((void));
75 extern void set_current_prompt_level __P((int));
76
77 /* Functions from version.c. */
78 extern char *shell_version_string __P((void));
79 extern void show_shell_version __P((int));
80
81 /* Declarations for functions defined in locale.c */
82 extern void set_default_locale __P((void));
83 extern void set_default_locale_vars __P((void));
84 extern int set_locale_var __P((char *, char *));
85 extern int set_lang __P((char *, char *));
86 extern char *get_locale_var __P((char *));
87 extern char *localetrans __P((char *, int, int *));
88
89 /* Declarations for functions defined in list.c. */
90 extern void map_over_list __P((GENERIC_LIST *, Function *));
91 extern void map_over_words __P((WORD_LIST *, Function *));
92 extern GENERIC_LIST *reverse_list ();
93 extern int list_length ();
94 extern GENERIC_LIST *list_append ();
95 extern GENERIC_LIST *delete_element ();
96
97 /* Declarations for functions defined in stringlib.c */
98 extern char **word_list_to_argv __P((WORD_LIST *, int, int, int *));
99 extern WORD_LIST *argv_to_word_list __P((char **, int, int));
100
101 extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int));
102
103 extern char *strsub __P((char *, char *, char *, int));
104 extern char *strcreplace __P((char *, int, char *, int));
105 extern void strip_leading __P((char *));
106 extern void strip_trailing __P((char *, int, int));
107 extern void xbcopy __P((char *, char *, int));
108
109 /* Functions from the bash library, lib/sh/libsh.a.  These should really
110    go into a separate include file. */
111
112 /* declarations for functions defined in lib/sh/clktck.c */
113 extern long get_clk_tck __P((void));
114
115 /* declarations for functions defined in lib/sh/clock.c */
116 extern void clock_t_to_secs ();
117 extern void print_clock_t ();
118
119 /* Declarations for functions defined in lib/sh/getcwd.c */
120 #if !defined (HAVE_GETCWD)
121 extern char *getcwd __P((char *, size_t));
122 #endif
123
124 /* Declarations for functions defined in lib/sh/itos.c */
125 extern char *inttostr __P((int, char *, int));
126 extern char *itos __P((int));
127
128 /* declarations for functions defined in lib/sh/makepath.c */
129 #define MP_DOTILDE      0x01
130 #define MP_DOCWD        0x02
131 #define MP_RMDOT        0x04
132
133 extern char *sh_makepath __P((char *, char *, int));
134
135 /* declarations for functions defined in lib/sh/netopen.c */
136 extern int netopen __P((char *));
137
138 /* Declarations for  functions defined in lib/sh/oslib.c */
139
140 extern int dup2 __P((int, int));
141
142 #if !defined (HAVE_GETDTABLESIZE)
143 extern int getdtablesize __P((void));
144 #endif /* !HAVE_GETDTABLESIZE */
145
146 #if !defined (HAVE_GETHOSTNAME)
147 extern int gethostname __P((char *, int));
148 #endif /* !HAVE_GETHOSTNAME */
149
150 /* declarations for functions defined in lib/sh/pathcanon.c */
151 #define PATH_CHECKDOTDOT        0x0001
152 #define PATH_CHECKEXISTS        0x0002
153 #define PATH_HARDPATH           0x0004
154 #define PATH_NOALLOC            0x0008
155
156 extern char *sh_canonpath __P((char *, int));
157
158 /* declarations for functions defined in lib/sh/pathphys.c */
159 extern char *sh_physpath __P((char *, int));
160 extern char *sh_realpath __P((const char *, char *));
161
162 /* declarations for functions defined in lib/sh/setlinebuf.c */
163 #if !defined (HAVE_SETLINEBUF)
164 extern int setlinebuf ();
165 #endif
166
167 /* declarations for functions defined in lib/sh/shquote.c */
168 extern char *sh_single_quote __P((char *));
169 extern char *sh_double_quote __P((char *));
170 extern char *sh_un_double_quote __P((char *));
171 extern char *sh_backslash_quote __P((char *));
172 extern char *sh_backslash_quote_for_double_quotes __P((char *));
173 extern int sh_contains_shell_metas __P((char *));
174
175 /* declarations for functions defined in lib/sh/spell.c */
176 extern int spname __P((char *, char *));
177
178 /* declarations for functions defined in lib/sh/strcasecmp.c */
179 #if !defined (HAVE_STRCASECMP)
180 extern int strncasecmp __P((const char *, const char *, int));
181 extern int strcasecmp __P((const char *, const char *));
182 #endif /* HAVE_STRCASECMP */
183
184 /* declarations for functions defined in lib/sh/strerror.c */
185 #if !defined (strerror)
186 extern char *strerror __P((int));
187 #endif
188
189 /* declarations for functions defined in lib/sh/strindex.c */
190 extern char *strindex __P((const char *, const char *));
191
192 /* declarations for functions and structures defined in lib/sh/stringlist.c */
193
194 /* This is a general-purpose argv-style array struct. */
195 typedef struct _list_of_strings {
196   char **list;
197   int list_size;
198   int list_len;
199 } STRINGLIST;
200
201 extern STRINGLIST *alloc_stringlist __P((int));
202 extern STRINGLIST *realloc_stringlist __P((STRINGLIST *, int));
203 extern void free_stringlist __P((STRINGLIST *));
204 extern STRINGLIST *copy_stringlist __P((STRINGLIST *));
205 extern STRINGLIST *merge_stringlists __P((STRINGLIST *, STRINGLIST *));
206 extern STRINGLIST *append_stringlist __P((STRINGLIST *, STRINGLIST *));
207 extern STRINGLIST *prefix_suffix_stringlist __P((STRINGLIST *, char *, char *));
208 extern void print_stringlist __P((STRINGLIST *, char *));
209 extern void sort_stringlist __P((STRINGLIST *));
210
211 /* declarations for functions defined in lib/sh/stringvec.c */
212
213 extern int find_name_in_array __P((char *, char **));
214 extern char **alloc_array __P((int));
215 extern int array_len __P((char **));
216 extern void free_array_members __P((char **));
217 extern void free_array __P((char **));
218 extern char **copy_array __P((char **));
219 extern int qsort_string_compare ();
220 extern void sort_char_array __P((char **));
221
222 /* declarations for functions defined in lib/sh/strtod.c */
223 #if !defined (HAVE_STRTOD)
224 extern double strtod __P((const char *, char **));
225 #endif
226
227 /* declarations for functions defined in lib/sh/strtol.c */
228 #if !defined (HAVE_STRTOL)
229 extern long strtol __P((const char *, char **, int));
230 #endif
231
232 /* declarations for functions defined in lib/sh/strtoul.c */
233 #if !defined (HAVE_STRTOUL)
234 extern unsigned long strtoul __P((const char *, char **, int));
235 #endif
236
237 /* declarations for functions defined in lib/sh/strtrans.c */
238 extern char *ansicstr __P((char *, int, int, int *, int *));
239 extern char *ansic_quote __P((char *, int, int *));
240
241 /* declarations for functions defined in lib/sh/timeval.c.  No prototypes
242    so we don't have to count on having a definition of struct timeval in
243    scope when this file is included. */
244 extern void timeval_to_secs ();
245 extern void print_timeval ();
246
247 /* declarations for functions defined in lib/sh/tmpfile.c */
248 #define MT_USETMPDIR            0x0001
249 #define MT_READWRITE            0x0002
250 #define MT_USERANDOM            0x0004
251
252 extern char *sh_mktmpname __P((char *, int));
253 extern int sh_mktmpfd __P((char *, int, char **));
254 /* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
255
256 /* declarations for functions defined in lib/sh/zread.c */
257 extern int zread __P((int, char *, size_t));
258 extern int zread1 __P((int, char *, size_t));
259 extern int zreadc __P((int, char *));
260 extern void zreset __P((void));
261 extern void zsyncfd __P((int));
262
263 /* declarations for functions defined in lib/sh/zwrite.c */
264 extern int zwrite __P((int, unsigned char *, size_t));
265
266 #endif /* _EXTERNS_H_ */