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