summaryrefslogtreecommitdiff
path: root/bin/csh/extern.h
blob: f5b7f7d4a483a4a7cb84cccf262276d0a0291281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/*	$OpenBSD: extern.h,v 1.6 2003/01/08 06:54:16 deraadt Exp $	*/
/*	$NetBSD: extern.h,v 1.8 1996/10/31 23:50:54 christos Exp $	*/

/*-
 * Copyright (c) 1991, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	@(#)extern.h	8.1 (Berkeley) 5/31/93
 */

#include <sys/cdefs.h>

/*
 * csh.c
 */
int	gethdir(Char *, int);
void	dosource(Char **, struct command *);
void	exitstat(void);
void	goodbye(void);
void	importpath(Char *);
void	initdesc(void);
void	pintr(int);
void	pintr1(bool);
void	printprompt(void);
void	process(bool);
void	rechist(void);
void	untty(void);
int	vis_fputc(int, FILE *);

#ifdef PROF
void done(int);
#else
void xexit(int);
#endif

/*
 * dir.c
 */
void	 dinit(Char *);
void	 dodirs(Char **, struct command *);
Char	*dcanon(Char *, Char *);
void	 dtildepr(Char *, Char *);
void	 dtilde(void);
void	 dochngd(Char **, struct command *);
Char	*dnormalize(Char *);
void	 dopushd(Char **, struct command *);
void	 dopopd(Char **, struct command *);
struct directory;
void	 dfree(struct directory *);

/*
 * dol.c
 */
void	 Dfix(struct command *);
Char	*Dfix1(Char *);
void	 heredoc(Char *);

/*
 * err.c
 */
void	seterror(int, ...);
void	stderror(int, ...);

/*
 * exec.c
 */
void	doexec(Char **, struct command *);
void	dohash(Char **, struct command *);
void	dounhash(Char **, struct command *);
void	dowhich(Char **, struct command *);
void	execash(Char **, struct command *);
void	hashstat(Char **, struct command *);
void	xechoit(Char **);

/*
 * exp.c
 */
int	expr(Char ***);
int	exp0(Char ***, bool);

/*
 * file.c
 */
#ifdef FILEC
int	tenex(Char *, int);
#endif

/*
 * func.c
 */
void	Setenv(Char *, Char *);
void	doalias(Char **, struct command *);
void	dobreak(Char **, struct command *);
void	docontin(Char **, struct command *);
void	doecho(Char **, struct command *);
void	doelse(Char **, struct command *);
void	doend(Char **, struct command *);
void	doeval(Char **, struct command *);
void	doexit(Char **, struct command *);
void	doforeach(Char **, struct command *);
void	doglob(Char **, struct command *);
void	dogoto(Char **, struct command *);
void	doif(Char **, struct command *);
void	dolimit(Char **, struct command *);
void	dologin(Char **, struct command *);
void	dologout(Char **, struct command *);
void	donohup(Char **, struct command *);
void	doonintr(Char **, struct command *);
void	doprintf(Char **, struct command *);
void	dorepeat(Char **, struct command *);
void	dosetenv(Char **, struct command *);
void	dosuspend(Char **, struct command *);
void	doswbrk(Char **, struct command *);
void	doswitch(Char **, struct command *);
void	doumask(Char **, struct command *);
void	dounlimit(Char **, struct command *);
void	dounsetenv(Char **, struct command *);
void	dowhile(Char **, struct command *);
void	dozip(Char **, struct command *);
void	func(struct command *, struct biltins *);
struct	biltins *
	isbfunc(struct command *);
void	prvars(void);
void	gotolab(Char *);
int	srchx(Char *);
void	unalias(Char **, struct command *);
void	wfree(void);

/*
 * glob.c
 */
Char	**dobackp(Char *, bool);
void	  Gcat(Char *, Char *);
Char	 *globone(Char *, int);
int	  Gmatch(Char *, Char *);
void	  ginit(void);
Char	**globall(Char **);
void	  rscan(Char **, void (*)());
void	  tglob(Char **);
void	  trim(Char **);
#ifdef FILEC
int	  sortscmp(const ptr_t, const ptr_t);
#endif /* FILEC */

/*
 * hist.c
 */
void	dohist(Char **, struct command *);
struct Hist *
	enthist(int, struct wordent *, bool);
void	savehist(struct wordent *);

/*
 * lex.c
 */
void	 addla(Char *);
void	 bseek(struct Ain *);
void	 btell(struct Ain *);
void	 btoeof(void);
void	 copylex(struct wordent *, struct wordent *);
Char	*domod(Char *, int);
void	 freelex(struct wordent *);
int	 lex(struct wordent *);
void	 prlex(FILE *, struct wordent *);
int	 readc(bool);
void	 settell(void);
void	 unreadc(int);

/*
 * misc.c
 */
int	  any(char *, int);
Char	**blkcat(Char **, Char **);
Char	**blkcpy(Char **, Char **);
Char	**blkend(Char **);
void	  blkfree(Char **);
int	  blklen(Char **);
void	  blkpr(FILE *, Char **);
Char	**blkspl(Char **, Char **);
void	  closem(void);
Char	**copyblk(Char **);
int	  dcopy(int, int);
int	  dmove(int, int);
void	  donefds(void);
Char	  lastchr(Char *);
void	  lshift(Char **, int);
int	  number(Char *);
int	  prefix(Char *, Char *);
Char	**saveblk(Char **);
void	  setzero(char *, int);
Char	 *strip(Char *);
Char	 *quote(Char *);
char	 *strsave(char *);
char	 *strspl(char *, char *);
void	  udvar(Char *);

#ifndef	SHORT_STRINGS
# ifdef NOTUSED
char	 *strstr(const char *, const char *);
# endif /* NOTUSED */
char	 *strend(char *);
#endif

/*
 * parse.c
 */
void	alias(struct wordent *);
void	freesyn(struct command *);
struct command *
	syntax(struct wordent *, struct wordent *, int);


/*
 * proc.c
 */
void	dobg(Char **, struct command *);
void	dobg1(Char **, struct command *);
void	dofg(Char **, struct command *);
void	dofg1(Char **, struct command *);
void	dojobs(Char **, struct command *);
void	dokill(Char **, struct command *);
void	donotify(Char **, struct command *);
void	dostop(Char **, struct command *);
void	dowait(Char **, struct command *);
void	palloc(int, struct command *);
void	panystop(bool);
void	pchild(int);
void	pendjob(void);
struct process *
	pfind(Char *);
int	pfork(struct command *, int);
void	pgetty(int, int);
void	pjwait(struct process *);
void	pnote(void);
void	prestjob(void);
void	psavejob(void);
void	pstart(struct process *, int);
void	pwait(void);

/*
 * sem.c
 */
void	execute(struct command *, int, int *, int *);
void	mypipe(int *);

/*
 * set.c
 */
struct	varent
	*adrof1(Char *, struct varent *);
void	 doset(Char **, struct command *);
void	 dolet(Char **, struct command *);
Char	*putn(int);
int	 getn(Char *);
Char	*value1(Char *, struct varent *);
void	 set(Char *, Char *);
void	 set1(Char *, Char **, struct varent *);
void	 setq(Char *, Char **, struct varent *);
void	 unset(Char **, struct command *);
void	 unset1(Char *[], struct varent *);
void	 unsetv(Char *);
void	 setNS(Char *);
void	 shift(Char **, struct command *);
void	 plist(struct varent *);

/*
 * time.c
 */
void	donice(Char **, struct command *);
void	dotime(Char **, struct command *);
void	prusage(struct rusage *, struct rusage *,
	    struct timeval *, struct timeval *);
void	ruadd(struct rusage *, struct rusage *);
void	settimes(void);
void	pcsecs(long);
void	psecs(long);

/*
 * alloc.c
 */
void	Free(ptr_t);
ptr_t	Malloc(size_t);
ptr_t	Realloc(ptr_t, size_t);
ptr_t	Calloc(size_t, size_t);
void	showall(Char **, struct command *);

/*
 * str.c:
 */
#ifdef SHORT_STRINGS
Char	 *s_strchr(Char *, int);
Char	 *s_strrchr(Char *, int);
Char	 *s_strcat(Char *, Char *);
#ifdef NOTUSED
Char	 *s_strncat(Char *, Char *, size_t);
#endif
Char	 *s_strcpy(Char *, Char *);
Char	 *s_strncpy(Char *, Char *, size_t);
Char	 *s_strspl(Char *, Char *);
size_t	  s_strlen(Char *);
int	  s_strcmp(Char *, Char *);
int	  s_strncmp(Char *, Char *, size_t);
Char	 *s_strsave(Char *);
Char	 *s_strend(Char *);
Char	 *s_strstr(Char *, Char *);
Char	 *str2short(char *);
Char	**blk2short(char **);
char	 *short2str(Char *);
char	**short2blk(Char **);
#endif
char	 *short2qstr(Char *);
char	 *vis_str(Char *);