extern.h revision 1.14 1 /* $NetBSD: extern.h,v 1.14 2001/09/14 14:04:00 wiz Exp $ */
2
3 /*-
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)extern.h 8.1 (Berkeley) 5/31/93
36 */
37
38 #ifndef _EXTERN_H_
39 #define _EXTERN_H_
40
41 #include <sys/cdefs.h>
42
43 /*
44 * csh.c
45 */
46 int gethdir(Char *);
47 void dosource(Char **, struct command *);
48 __dead void exitstat __P((void)) __attribute__((noreturn));
49 void goodbye(void);
50 void importpath(Char *);
51 void initdesc(void);
52 void pintr(int);
53 void pintr1 __P((bool)) __attribute__((noreturn));
54 void printprompt(void);
55 void process(bool);
56 void rechist(void);
57 void untty(void);
58 int vis_fputc(int, FILE *);
59
60 #ifdef PROF
61 __dead void done __P((int)) __attribute__((noreturn));
62 #else
63 __dead void xexit __P((int)) __attribute__((noreturn));
64 #endif
65
66 /*
67 * dir.c
68 */
69 void dinit(Char *);
70 void dodirs(Char **, struct command *);
71 Char *dcanon(Char *, Char *);
72 void dtildepr(Char *, Char *);
73 void dtilde(void);
74 void dochngd(Char **, struct command *);
75 Char *dnormalize(Char *);
76 void dopushd(Char **, struct command *);
77 void dopopd(Char **, struct command *);
78 struct directory;
79 void dfree(struct directory *);
80
81 /*
82 * dol.c
83 */
84 void Dfix(struct command *);
85 Char *Dfix1(Char *);
86 void heredoc(Char *);
87
88 /*
89 * err.c
90 */
91 void seterror(int, ...);
92 __dead void stderror __P((int, ...)) __attribute__((noreturn));
93
94 /*
95 * exec.c
96 */
97 void doexec __P((Char **, struct command *)) __attribute__((noreturn));
98 void dohash(Char **, struct command *);
99 void dounhash(Char **, struct command *);
100 void dowhich(Char **, struct command *);
101 void execash(Char **, struct command *);
102 void hashstat(Char **, struct command *);
103 void xechoit(Char **);
104
105 /*
106 * exp.c
107 */
108 int expr(Char ***);
109 int exp0(Char ***, bool);
110
111 /*
112 * file.c
113 */
114 #ifdef FILEC
115 int tenex(Char *, int);
116 #endif
117
118 /*
119 * func.c
120 */
121 void Setenv(Char *, Char *);
122 void doalias(Char **, struct command *);
123 void dobreak(Char **, struct command *);
124 void docontin(Char **, struct command *);
125 void doecho(Char **, struct command *);
126 void doelse(Char **, struct command *);
127 void doend(Char **, struct command *);
128 void doeval(Char **, struct command *);
129 void doexit(Char **, struct command *);
130 void doforeach(Char **, struct command *);
131 void doglob(Char **, struct command *);
132 void dogoto(Char **, struct command *);
133 void doif(Char **, struct command *);
134 void dolimit(Char **, struct command *);
135 void dologin(Char **, struct command *);
136 void dologout(Char **, struct command *);
137 void donohup(Char **, struct command *);
138 void doonintr(Char **, struct command *);
139 void doprintf(Char **, struct command *);
140 void dorepeat(Char **, struct command *);
141 void dosetenv(Char **, struct command *);
142 void dosuspend(Char **, struct command *);
143 void doswbrk(Char **, struct command *);
144 void doswitch(Char **, struct command *);
145 void doumask(Char **, struct command *);
146 void dounlimit(Char **, struct command *);
147 void dounsetenv(Char **, struct command *);
148 void dowhile(Char **, struct command *);
149 void dozip(Char **, struct command *);
150 void func(struct command *, struct biltins *);
151 struct biltins *isbfunc(struct command *);
152 void prvars(void);
153 void gotolab(Char *);
154 int srchx(Char *);
155 void unalias(Char **, struct command *);
156 void wfree(void);
157
158 /*
159 * glob.c
160 */
161 Char **dobackp(Char *, bool);
162 void Gcat(Char *, Char *);
163 Char *globone(Char *, int);
164 int Gmatch(Char *, Char *);
165 void ginit(void);
166 Char **globall(Char **);
167 void rscan(Char **, void (*)(int));
168 void tglob(Char **);
169 void trim(Char **);
170 #ifdef FILEC
171 int sortscmp(const ptr_t, const ptr_t);
172 #endif /* FILEC */
173
174 /*
175 * hist.c
176 */
177 void dohist(Char **, struct command *);
178 struct Hist *enthist(int, struct wordent *, bool);
179 void savehist(struct wordent *);
180
181 /*
182 * lex.c
183 */
184 void addla(Char *);
185 void bseek(struct Ain *);
186 void btell(struct Ain *);
187 void btoeof(void);
188 void copylex(struct wordent *, struct wordent *);
189 Char *domod(Char *, int);
190 void freelex(struct wordent *);
191 int lex(struct wordent *);
192 void prlex(FILE *, struct wordent *);
193 int readc(bool);
194 void settell(void);
195 void unreadc(int);
196
197 /*
198 * misc.c
199 */
200 int any(char *, int);
201 Char **blkcat(Char **, Char **);
202 Char **blkcpy(Char **, Char **);
203 Char **blkend(Char **);
204 void blkfree(Char **);
205 int blklen(Char **);
206 void blkpr(FILE *, Char **);
207 Char **blkspl(Char **, Char **);
208 void closem(void);
209 Char **copyblk(Char **);
210 int dcopy(int, int);
211 int dmove(int, int);
212 void donefds(void);
213 Char lastchr(Char *);
214 void lshift(Char **, int);
215 int number(Char *);
216 int prefix(Char *, Char *);
217 Char **saveblk(Char **);
218 Char *strip(Char *);
219 Char *quote(Char *);
220 char *strsave(char *);
221 char *strspl(char *, char *);
222 void udvar __P((Char *)) __attribute__((noreturn));
223
224 #ifndef SHORT_STRINGS
225 # ifdef NOTUSED
226 char *strstr(const char *, const char *);
227 # endif /* NOTUSED */
228 char *strend(char *);
229 #endif
230
231 /*
232 * parse.c
233 */
234 void alias(struct wordent *);
235 void freesyn(struct command *);
236 struct command *syntax(struct wordent *, struct wordent *, int);
237
238
239 /*
240 * proc.c
241 */
242 void dobg(Char **, struct command *);
243 void dobg1(Char **, struct command *);
244 void dofg(Char **, struct command *);
245 void dofg1(Char **, struct command *);
246 void dojobs(Char **, struct command *);
247 void dokill(Char **, struct command *);
248 void donotify(Char **, struct command *);
249 void dostop(Char **, struct command *);
250 void dowait(Char **, struct command *);
251 void palloc(int, struct command *);
252 void panystop(bool);
253 void pchild(int);
254 void pendjob(void);
255 struct process *pfind(Char *);
256 int pfork(struct command *, int);
257 void pgetty(int, int);
258 void pjwait(struct process *);
259 void pnote(void);
260 void prestjob(void);
261 void psavejob(void);
262 void pstart(struct process *, int);
263 void pwait(void);
264
265 /*
266 * sem.c
267 */
268 void execute(struct command *, int, int *, int *);
269 void mypipe(int *);
270
271 /*
272 * set.c
273 */
274 struct varent*adrof1(Char *, struct varent *);
275 void doset(Char **, struct command *);
276 void dolet(Char **, struct command *);
277 Char *putn(int);
278 int getn(Char *);
279 Char *value1(Char *, struct varent *);
280 void set(Char *, Char *);
281 void set1(Char *, Char **, struct varent *);
282 void setq(Char *, Char **, struct varent *);
283 void unset(Char **, struct command *);
284 void unset1(Char *[], struct varent *);
285 void unsetv(Char *);
286 void setNS(Char *);
287 void shift(Char **, struct command *);
288 void plist(struct varent *);
289
290 /*
291 * time.c
292 */
293 void donice(Char **, struct command *);
294 void dotime(Char **, struct command *);
295 void prusage(struct rusage *, struct rusage *, struct timeval *,
296 struct timeval *);
297 void ruadd(struct rusage *, struct rusage *);
298 void settimes(void);
299 void pcsecs(long);
300 void psecs(long);
301
302 /*
303 * alloc.c
304 */
305 void Free(ptr_t);
306 ptr_t Malloc(size_t);
307 ptr_t Realloc(ptr_t, size_t);
308 ptr_t Calloc(size_t, size_t);
309 void showall(Char **, struct command *);
310
311 /*
312 * str.c:
313 */
314 #ifdef SHORT_STRINGS
315 Char *s_strchr(Char *, int);
316 Char *s_strrchr(Char *, int);
317 Char *s_strcat(Char *, Char *);
318 #ifdef NOTUSED
319 Char *s_strncat(Char *, Char *, size_t);
320 #endif
321 Char *s_strcpy(Char *, Char *);
322 Char *s_strncpy(Char *, Char *, size_t);
323 Char *s_strspl(Char *, Char *);
324 size_t s_strlen(Char *);
325 int s_strcmp(Char *, Char *);
326 int s_strncmp(Char *, Char *, size_t);
327 Char *s_strsave(Char *);
328 Char *s_strend(Char *);
329 Char *s_strstr(Char *, Char *);
330 Char *str2short(const char *);
331 Char **blk2short(char **);
332 char *short2str(Char *);
333 char **short2blk(Char **);
334 #endif
335 char *short2qstr(Char *);
336 char *vis_str(Char *);
337
338 #endif /* !_EXTERN_H_ */
339