1/* $NetBSD: extern.h,v 1.31 2019/01/05 16:54:00 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 */
42int gethdir(Char *);
43void dosource(Char **, struct command *);
44__dead void exitstat(void);
45__dead void goodbye(void);
46void importpath(Char *);
47void initdesc(void);
48__dead void pintr(int);
49__dead void pintr1(int);
50void printprompt(void);
51#ifdef EDIT
52char *printpromptstr(EditLine *);
53#endif
54void process(int);
55void rechist(void);
56void untty(void);
57int vis_fputc(int, FILE *);
58
59#ifdef PROF
60__dead void done(int);
61#else
62__dead void xexit(int);
63#endif
64
65/*
66 * dir.c
67 */
68void dinit(Char *);
69void dodirs(Char **, struct command *);
70Char *dcanon(Char *, Char *);
71void dtildepr(Char *, Char *);
72void dtilde(void);
73void dochngd(Char **, struct command *);
74Char *dnormalize(Char *);
75void dopushd(Char **, struct command *);
76void dopopd(Char **, struct command *);
77struct directory;
78void dfree(struct directory *);
79
80/*
81 * dol.c
82 */
83void Dfix(struct command *);
84Char *Dfix1(Char *);
85void heredoc(Char *);
86
87/*
88 * err.c
89 */
90void seterror(int, ...);
91__dead void stderror(int, ...);
92
93/*
94 * exec.c
95 */
96__dead void doexec(Char **, struct command *);
97void dohash(Char **, struct command *);
98void dounhash(Char **, struct command *);
99void dowhich(Char **, struct command *);
100void execash(Char **, struct command *);
101void hashstat(Char **, struct command *);
102void xechoit(Char **);
103
104/*
105 * exp.c
106 */
107int expr(Char ***);
108int exp0(Char ***, int);
109
110/*
111 * file.c
112 */
113#ifdef FILEC
114ssize_t tenex(Char *, size_t);
115#endif
116
117/*
118 * func.c
119 */
120void Setenv(Char *, Char *);
121void doalias(Char **, struct command *);
122void dobreak(Char **, struct command *);
123void docontin(Char **, struct command *);
124void doecho(Char **, struct command *);
125void doelse(Char **, struct command *);
126void doend(Char **, struct command *);
127void doeval(Char **, struct command *);
128void doexit(Char **, struct command *);
129void doforeach(Char **, struct command *);
130void doglob(Char **, struct command *);
131void dogoto(Char **, struct command *);
132void doif(Char **, struct command *);
133void dolimit(Char **, struct command *);
134__dead void dologin(Char **, struct command *);
135__dead void dologout(Char **, struct command *);
136void donohup(Char **, struct command *);
137void doonintr(Char **, struct command *);
138void doprintf(Char **, struct command *);
139void dorepeat(Char **, struct command *);
140void dosetenv(Char **, struct command *);
141void dosuspend(Char **, struct command *);
142void doswbrk(Char **, struct command *);
143void doswitch(Char **, struct command *);
144void doumask(Char **, struct command *);
145void dounlimit(Char **, struct command *);
146void dounsetenv(Char **, struct command *);
147void dowhile(Char **, struct command *);
148void dozip(Char **, struct command *);
149void func(struct command *, struct biltins *);
150struct biltins *isbfunc(struct command *);
151void prvars(void);
152void gotolab(Char *);
153int srchx(Char *);
154void unalias(Char **, struct command *);
155void wfree(void);
156
157/*
158 * glob.c
159 */
160Char **dobackp(Char *, int);
161void Gcat(Char *, Char *);
162Char *globone(Char *, int);
163int Gmatch(Char *, Char *);
164void ginit(void);
165Char **globall(Char **);
166void rscan(Char **, void (*)(int));
167void tglob(Char **);
168void trim(Char **);
169#ifdef FILEC
170int sortscmp(const void *, const void *);
171#endif /* FILEC */
172
173/*
174 * hist.c
175 */
176void dohist(Char **, struct command *);
177struct Hist *enthist(int, struct wordent *, int);
178#ifdef EDIT
179void loadhist(struct Hist *);
180#endif
181void savehist(struct wordent *);
182
183/*
184 * lex.c
185 */
186void addla(Char *);
187void bseek(struct Ain *);
188void btell(struct Ain *);
189void btoeof(void);
190void copylex(struct wordent *, struct wordent *);
191Char *domod(Char *, int);
192void freelex(struct wordent *);
193int lex(struct wordent *);
194void prlex(FILE *, struct wordent *);
195#ifdef EDIT
196int sprlex(char **, struct wordent *);
197#endif
198int readc(int);
199void settell(void);
200void unreadc(int);
201
202/*
203 * misc.c
204 */
205int any(const char *, int);
206Char **blkcat(Char **, Char **);
207Char **blkcpy(Char **, Char **);
208Char **blkend(Char **);
209void blkfree(Char **);
210int blklen(Char **);
211void blkpr(FILE *, Char **);
212Char **blkspl(Char **, Char **);
213void closem(void);
214Char **copyblk(Char **);
215int dcopy(int, int);
216int dmove(int, int);
217void donefds(void);
218Char lastchr(Char *);
219void lshift(Char **, size_t);
220int number(Char *);
221int prefix(Char *, Char *);
222Char **saveblk(Char **);
223Char *strip(Char *);
224Char *quote(Char *);
225char *strsave(const char *);
226char *strspl(char *, char *);
227__dead void udvar(Char *);
228
229#ifndef SHORT_STRINGS
230# ifdef NOTUSED
231char *strstr(const char *, const char *);
232# endif /* NOTUSED */
233char *strend(char *);
234#endif
235
236/*
237 * parse.c
238 */
239void alias(struct wordent *);
240void freesyn(struct command *);
241struct command *syntax(struct wordent *, struct wordent *, int);
242
243
244/*
245 * proc.c
246 */
247void dobg(Char **, struct command *);
248void dobg1(Char **, struct command *);
249void dofg(Char **, struct command *);
250void dofg1(Char **, struct command *);
251void dojobs(Char **, struct command *);
252void dokill(Char **, struct command *);
253void donotify(Char **, struct command *);
254void dostop(Char **, struct command *);
255void dowait(Char **, struct command *);
256void palloc(int, struct command *);
257void panystop(int);
258void pchild(int);
259void pendjob(void);
260struct process *pfind(Char *);
261int pfork(struct command *, int);
262void pgetty(int, int);
263void pjwait(struct process *);
264void pnote(void);
265void prestjob(void);
266void psavejob(void);
267void pstart(struct process *, int);
268void pwait(void);
269
270/*
271 * sem.c
272 */
273void execute(struct command *, int, int *, int *);
274void mypipe(int *);
275
276/*
277 * set.c
278 */
279struct varent*adrof1(Char *, struct varent *);
280void doset(Char **, struct command *);
281void dolet(Char **, struct command *);
282Char *putn(int);
283int getn(Char *);
284Char *value1(Char *, struct varent *);
285void set(Char *, Char *);
286void set1(Char *, Char **, struct varent *);
287void setq(Char *, Char **, struct varent *);
288void unset(Char **, struct command *);
289void unset1(Char *[], struct varent *);
290void unsetv(Char *);
291void setNS(Char *);
292void shift(Char **, struct command *);
293void plist(struct varent *);
294
295/*
296 * time.c
297 */
298void donice(Char **, struct command *);
299void dotime(Char **, struct command *);
300void prusage1(FILE *, const char *, struct rusage *, struct rusage *,
301 struct timespec *, struct timespec *);
302void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
303 struct timespec *);
304void ruadd(struct rusage *, struct rusage *);
305void settimes(void);
306void psecs(long);
307
308/*
309 * alloc.c
310 */
311void Free(void *);
312void * Malloc(size_t);
313void *Realloc(void *, size_t);
314void *Calloc(size_t, size_t);
315
316/*
317 * str.c:
318 */
319#ifdef SHORT_STRINGS
320Char *s_strchr(const Char *, int);
321Char *s_strrchr(const Char *, int);
322Char *s_strcat(Char *, const Char *);
323#ifdef NOTUSED
324Char *s_strncat(Char *, const Char *, size_t);
325#endif
326Char *s_strcpy(Char *, const Char *);
327Char *s_strncpy(Char *, const Char *, size_t);
328Char *s_strspl(const Char *, const Char *);
329size_t s_strlen(const Char *);
330int s_strcmp(const Char *, const Char *);
331int s_strncmp(const Char *, const Char *, size_t);
332Char *s_strsave(const Char *);
333Char *s_strend(const Char *);
334Char *s_strstr(const Char *, const Char *);
335Char *str2short(const char *);
336Char **blk2short(char **);
337char *short2str(const Char *);
338char **short2blk(Char * const *);
339#endif
340char *short2qstr(const Char *);
341char *vis_str(const Char *);
342
343#endif /* !_EXTERN_H_ */
344