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