xref: /plan9/sys/src/ape/cmd/pdksh/proto.h (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1 /*
2  * prototypes for PD-KSH
3  * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang "
4  * $Id: proto.h,v 1.3 1994/05/19 18:32:40 michael Exp michael $
5  */
6 
7 /* alloc.c */
8 Area *	ainit		ARGS((Area *ap));
9 void 	afreeall	ARGS((Area *ap));
10 void *	alloc		ARGS((size_t size, Area *ap));
11 void *	aresize		ARGS((void *ptr, size_t size, Area *ap));
12 void 	afree		ARGS((void *ptr, Area *ap));
13 /* c_ksh.c */
14 int 	c_hash		ARGS((char **wp));
15 int 	c_cd		ARGS((char **wp));
16 int 	c_pwd		ARGS((char **wp));
17 int 	c_print		ARGS((char **wp));
18 int 	c_whence	ARGS((char **wp));
19 int 	c_command	ARGS((char **wp));
20 int 	c_typeset	ARGS((char **wp));
21 int 	c_alias		ARGS((char **wp));
22 int 	c_unalias	ARGS((char **wp));
23 int 	c_let		ARGS((char **wp));
24 int 	c_jobs		ARGS((char **wp));
25 int 	c_fgbg		ARGS((char **wp));
26 int 	c_kill		ARGS((char **wp));
27 void	getopts_reset	ARGS((int val));
28 int	c_getopts	ARGS((char **wp));
29 int 	c_bind		ARGS((char **wp));
30 /* c_sh.c */
31 int 	c_label		ARGS((char **wp));
32 int 	c_shift		ARGS((char **wp));
33 int 	c_umask		ARGS((char **wp));
34 int 	c_dot		ARGS((char **wp));
35 int 	c_wait		ARGS((char **wp));
36 int 	c_read		ARGS((char **wp));
37 int 	c_eval		ARGS((char **wp));
38 int 	c_trap		ARGS((char **wp));
39 int 	c_brkcont	ARGS((char **wp));
40 int 	c_exitreturn	ARGS((char **wp));
41 int 	c_set		ARGS((char **wp));
42 int 	c_unset		ARGS((char **wp));
43 int 	c_ulimit	ARGS((char **wp));
44 int 	c_times		ARGS((char **wp));
45 int 	timex		ARGS((struct op *t, int f));
46 void	timex_hook	ARGS((struct op *t, char ** volatile *app));
47 int 	c_exec		ARGS((char **wp));
48 int 	c_builtin	ARGS((char **wp));
49 /* c_test.c */
50 int 	c_test		ARGS((char **wp));
51 /* edit.c: most prototypes in edit.h */
52 void 	x_init		ARGS((void));
53 int 	x_read		ARGS((char *buf, size_t len));
54 void	set_editmode	ARGS((const char *ed));
55 /* emacs.c: most prototypes in edit.h */
56 int 	x_bind		ARGS((const char *a1, const char *a2, int macro,
57 			      int list));
58 /* eval.c */
59 char *	substitute	ARGS((const char *cp, int f));
60 char **	eval		ARGS((char **ap, int f));
61 char *	evalstr		ARGS((char *cp, int f));
62 char *	evalonestr	ARGS((char *cp, int f));
63 char	*debunk		ARGS((char *dp, const char *sp));
64 void	expand		ARGS((char *cp, XPtrV *wp, int f));
65 int glob_str		ARGS((char *cp, XPtrV *wp, int markdirs));
66 /* exec.c */
67 int	fd_clexec	ARGS((int fd));
68 int 	execute		ARGS((struct op * volatile t, volatile int flags));
69 int 	shcomexec	ARGS((char **wp));
70 struct tbl * findfunc	ARGS((const char *name, unsigned int h, int create));
71 int 	define		ARGS((const char *name, struct op *t));
72 void 	builtin		ARGS((const char *name, int (*func)(char **)));
73 struct tbl *	findcom	ARGS((const char *name, int flags));
74 void 	flushcom	ARGS((int all));
75 char *	search		ARGS((const char *name, const char *path, int mode,
76 			      int *errnop));
77 int	search_access	ARGS((const char *path, int mode, int *errnop));
78 int	pr_menu		ARGS((char *const *ap));
79 /* expr.c */
80 int 	evaluate	ARGS((const char *expr, long *rval, int error_ok));
81 int	v_evaluate	ARGS((struct tbl *vp, const char *expr, volatile int error_ok));
82 /* history.c */
83 void	init_histvec	ARGS((void));
84 void 	hist_init	ARGS((Source *s));
85 void 	hist_finish	ARGS((void));
86 void	histsave	ARGS((int lno, const char *cmd, int dowrite));
87 #ifdef HISTORY
88 int 	c_fc	 	ARGS((register char **wp));
89 void	sethistsize	ARGS((int n));
90 void	sethistfile	ARGS((const char *name));
91 # ifdef EASY_HISTORY
92 void 	histappend	ARGS((const char *cmd, int nl_separate));
93 # endif
94 char **	histpos	 	ARGS((void));
95 int 	histN	 	ARGS((void));
96 int 	histnum	 	ARGS((int n));
97 int	findhist	ARGS((int start, int fwd, const char *str,
98 			      int anchored));
99 #endif /* HISTORY */
100 /* io.c */
101 void 	errorf		ARGS((const char *fmt, ...))
102 				GCC_FUNC_ATTR2(noreturn, format(printf, 1, 2));
103 void 	warningf	ARGS((int fileline, const char *fmt, ...))
104 				GCC_FUNC_ATTR(format(printf, 2, 3));
105 void 	bi_errorf	ARGS((const char *fmt, ...))
106 				GCC_FUNC_ATTR(format(printf, 1, 2));
107 void 	internal_errorf	ARGS((int jump, const char *fmt, ...))
108 				GCC_FUNC_ATTR(format(printf, 2, 3));
109 void	error_prefix	ARGS((int fileline));
110 void 	shellf		ARGS((const char *fmt, ...))
111 				GCC_FUNC_ATTR(format(printf, 1, 2));
112 void 	shprintf	ARGS((const char *fmt, ...))
113 				GCC_FUNC_ATTR(format(printf, 1, 2));
114 #ifdef KSH_DEBUG
115 void 	kshdebug_init_	ARGS((void));
116 void 	kshdebug_printf_ ARGS((const char *fmt, ...))
117 				GCC_FUNC_ATTR(format(printf, 1, 2));
118 void 	kshdebug_dump_	ARGS((const char *str, const void *mem, int nbytes));
119 #endif /* KSH_DEBUG */
120 int	can_seek	ARGS((int fd));
121 void	initio		ARGS((void));
122 int	ksh_dup2	ARGS((int ofd, int nfd, int errok));
123 int 	savefd		ARGS((int fd, int noclose));
124 void 	restfd		ARGS((int fd, int ofd));
125 void 	openpipe	ARGS((int *pv));
126 void 	closepipe	ARGS((int *pv));
127 int	check_fd	ARGS((char *name, int mode, const char **emsgp));
128 #ifdef KSH
129 void	coproc_init	ARGS((void));
130 void	coproc_read_close ARGS((int fd));
131 void	coproc_readw_close ARGS((int fd));
132 void	coproc_write_close ARGS((int fd));
133 int	coproc_getfd	ARGS((int mode, const char **emsgp));
134 void	coproc_cleanup	ARGS((int reuse));
135 #endif /* KSH */
136 struct temp *maketemp	ARGS((Area *ap, Temp_type type, struct temp **tlist));
137 /* jobs.c */
138 void 	j_init		ARGS((int mflagset));
139 void 	j_exit		ARGS((void));
140 void 	j_change	ARGS((void));
141 int 	exchild		ARGS((struct op *t, int flags, int close_fd));
142 void 	startlast	ARGS((void));
143 int 	waitlast	ARGS((void));
144 int 	waitfor		ARGS((const char *cp, int *sigp));
145 int 	j_kill		ARGS((const char *cp, int sig));
146 int 	j_resume	ARGS((const char *cp, int bg));
147 int 	j_jobs		ARGS((const char *cp, int slp, int nflag));
148 void 	j_notify	ARGS((void));
149 pid_t	j_async		ARGS((void));
150 int 	j_stopped_running	ARGS((void));
151 /* lex.c */
152 int 	yylex		ARGS((int cf));
153 void 	yyerror		ARGS((const char *fmt, ...))
154 				GCC_FUNC_ATTR2(noreturn, format(printf, 1, 2));
155 Source * pushs		ARGS((int type, Area *areap));
156 void	set_prompt	ARGS((int to, Source *s));
157 void 	pprompt		ARGS((const char *cp, int ntruncate));
158 /* mail.c */
159 #ifdef KSH
160 void 	mcheck		ARGS((void));
161 void 	mcset		ARGS((long interval));
162 void 	mbset		ARGS((char *p));
163 void 	mpset		ARGS((char *mptoparse));
164 #endif /* KSH */
165 /* main.c */
166 int 	include		ARGS((const char *name, int argc, char **argv,
167 			      int intr_ok));
168 int 	command		ARGS((const char *comm));
169 int 	shell		ARGS((Source *volatile s, int volatile toplevel));
170 void 	unwind		ARGS((int i)) GCC_FUNC_ATTR(noreturn);
171 void 	newenv		ARGS((int type));
172 void 	quitenv		ARGS((void));
173 void	cleanup_parents_env ARGS((void));
174 void	cleanup_proc_env ARGS((void));
175 void 	aerror		ARGS((Area *ap, const char *msg))
176 				GCC_FUNC_ATTR(noreturn);
177 /* misc.c */
178 void 	setctypes	ARGS((const char *s, int t));
179 void 	initctypes	ARGS((void));
180 char *	ulton		ARGS((unsigned long n, int base));
181 char *	str_save	ARGS((const char *s, Area *ap));
182 char *	str_nsave	ARGS((const char *s, int n, Area *ap));
183 int	option		ARGS((const char *n));
184 char *	getoptions	ARGS((void));
185 void	change_flag	ARGS((enum sh_flag f, int what, int newval));
186 int	parse_args	ARGS((char **argv, int what, int *setargsp));
187 int 	getn		ARGS((const char *as, int *ai));
188 int 	bi_getn		ARGS((const char *as, int *ai));
189 char *	strerror	ARGS((int i));
190 int 	gmatch		ARGS((const char *s, const char *p, int isfile));
191 int	has_globbing	ARGS((const char *xp, const char *xpe));
192 const unsigned char *pat_scan ARGS((const unsigned char *p,
193 				const unsigned char *pe, int match_sep));
194 void 	qsortp		ARGS((void **base, size_t n, int (*f)(void *, void *)));
195 int 	xstrcmp		ARGS((void *p1, void *p2));
196 void	ksh_getopt_reset ARGS((Getopt *go, int));
197 int	ksh_getopt	ARGS((char **argv, Getopt *go, const char *options));
198 void	print_value_quoted ARGS((const char *s));
199 void	print_columns	ARGS((struct shf *shf, int n,
200 			      char *(*func)(void *, int, char *, int),
201 			      void *arg, int max_width));
202 int	strip_nuls	ARGS((char *buf, int nbytes));
203 char	*str_zcpy	ARGS((char *dst, const char *src, int dsize));
204 int	blocking_read	ARGS((int fd, char *buf, int nbytes));
205 int	reset_nonblock	ARGS((int fd));
206 char	*ksh_get_wd	ARGS((char *buf, int bsize));
207 /* path.c */
208 int	make_path	ARGS((const char *cwd, const char *file,
209 			      char **pathlist, XString *xsp, int *phys_pathp));
210 void	simplify_path	ARGS((char *path));
211 char	*get_phys_path	ARGS((const char *path));
212 void	set_current_wd	ARGS((char *path));
213 /* syn.c */
214 void 	initkeywords	ARGS((void));
215 struct op * compile	ARGS((Source *s));
216 /* table.c */
217 unsigned int 	hash	ARGS((const char *n));
218 void 	tinit		ARGS((struct table *tp, Area *ap, int tsize));
219 struct tbl *	tsearch	ARGS((struct table *tp, const char *n, unsigned int h));
220 struct tbl *	tenter	ARGS((struct table *tp, const char *n, unsigned int h));
221 void 	tdelete		ARGS((struct tbl *p));
222 void 	twalk		ARGS((struct tstate *ts, struct table *tp));
223 struct tbl *	tnext	ARGS((struct tstate *ts));
224 struct tbl **	tsort	ARGS((struct table *tp));
225 /* trace.c */
226 /* trap.c */
227 void	inittraps	ARGS((void));
228 #ifdef KSH
229 void	alarm_init	ARGS((void));
230 #endif /* KSH */
231 Trap *	gettrap		ARGS((const char *name, int igncase));
232 RETSIGTYPE trapsig	ARGS((int i));
233 void	intrcheck	ARGS((void));
234 int	fatal_trap_check ARGS((void));
235 int	trap_pending	ARGS((void));
236 void 	runtraps	ARGS((int intr));
237 void 	runtrap		ARGS((Trap *p));
238 void 	cleartraps	ARGS((void));
239 void 	restoresigs	ARGS((void));
240 void	settrap		ARGS((Trap *p, char *s));
241 int	block_pipe	ARGS((void));
242 void	restore_pipe	ARGS((int restore_dfl));
243 int	setsig		ARGS((Trap *p, handler_t f, int flags));
244 void	setexecsig	ARGS((Trap *p, int restore));
245 /* tree.c */
246 int 	fptreef		ARGS((struct shf *f, int indent, const char *fmt, ...));
247 char *	snptreef	ARGS((char *s, int n, const char *fmt, ...));
248 struct op *	tcopy	ARGS((struct op *t, Area *ap));
249 char *	wdcopy		ARGS((const char *wp, Area *ap));
250 char *	wdscan		ARGS((const char *wp, int c));
251 char *	wdstrip		ARGS((const char *wp));
252 void 	tfree		ARGS((struct op *t, Area *ap));
253 /* var.c */
254 void 	newblock	ARGS((void));
255 void 	popblock	ARGS((void));
256 void	initvar		ARGS((void));
257 struct tbl *	global	ARGS((const char *n));
258 struct tbl *	local	ARGS((const char *n, bool_t copy));
259 char *	str_val		ARGS((struct tbl *vp));
260 long 	intval		ARGS((struct tbl *vp));
261 int 	setstr		ARGS((struct tbl *vq, const char *s, int error_ok));
262 struct tbl *setint_v	ARGS((struct tbl *vq, struct tbl *vp));
263 void 	setint		ARGS((struct tbl *vq, long n));
264 int	getint		ARGS((struct tbl *vp, long *nump));
265 struct tbl *	typeset	ARGS((const char *var, Tflag set, Tflag clr, int field, int base));
266 void 	unset		ARGS((struct tbl *vp, int array_ref));
267 char  * skip_varname	ARGS((const char *s, int aok));
268 char	*skip_wdvarname ARGS((const char *s, int aok));
269 int	is_wdvarname	ARGS((const char *s, int aok));
270 int	is_wdvarassign	ARGS((const char *s));
271 char **	makenv		ARGS((void));
272 void	change_random	ARGS((void));
273 int	array_ref_len	ARGS((const char *cp));
274 char *	arrayname	ARGS((const char *str));
275 void    set_array	ARGS((const char *var, int reset, char **vals));
276 /* version.c */
277 /* vi.c: see edit.h */
278 
279 
280 /* Hack to avoid billions of compile warnings on SunOS 4.1.x */
281 #if defined(MUN) && defined(sun) && !defined(__svr4__)
282 extern void bcopy ARGS((const void *src, void *dst, size_t size));
283 extern int fclose ARGS((FILE *fp));
284 extern int fprintf ARGS((FILE *fp, const char *fmt, ...));
285 extern int fread ARGS((void *buf, int size, int num, FILE *fp));
286 extern int ioctl ARGS((int fd, int request, void *arg));
287 extern int killpg ARGS((int pgrp, int sig));
288 extern int nice ARGS((int n));
289 extern int readlink ARGS((const char *path, char *buf, int bufsize));
290 extern int setpgrp ARGS((int pid, int pgrp));
291 extern int strcasecmp ARGS((const char *s1, const char *s2));
292 extern int tolower ARGS((int));
293 extern int toupper ARGS((int));
294 /*  Include files aren't included yet */
295 extern int getrlimit ARGS(( /* int resource, struct rlimit *rpl */ ));
296 extern int getrusage ARGS(( /* int who, struct rusage *rusage */ ));
297 extern int gettimeofday ARGS(( /* struct timeval *tv, struct timezone *tz */ ));
298 extern int setrlimit ARGS(( /* int resource, struct rlimit *rlp */ ));
299 extern int lstat ARGS(( /* const char *path, struct stat *buf */ ));
300 #endif
301