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