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