1 /* $NetBSD: proto.h,v 1.5 2002/09/25 02:41:11 provos 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.5 2002/09/25 02:41:11 provos 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 int pr_list ARGS((char *const *ap)); 82 /* expr.c */ 83 int evaluate ARGS((const char *expr, long *rval, int error_ok)); 84 int v_evaluate ARGS((struct tbl *vp, const char *expr, volatile int error_ok)); 85 /* history.c */ 86 void init_histvec ARGS((void)); 87 void hist_init ARGS((Source *s)); 88 void hist_finish ARGS((void)); 89 void histsave ARGS((int lno, const char *cmd, int dowrite)); 90 #ifdef HISTORY 91 int c_fc ARGS((register char **wp)); 92 void sethistsize ARGS((int n)); 93 void sethistfile ARGS((const char *name)); 94 # ifdef EASY_HISTORY 95 void histappend ARGS((const char *cmd, int nl_separate)); 96 # endif 97 char ** histpos ARGS((void)); 98 int histN ARGS((void)); 99 int histnum ARGS((int n)); 100 int findhist ARGS((int start, int fwd, const char *str, 101 int anchored)); 102 #endif /* HISTORY */ 103 /* io.c */ 104 void errorf ARGS((const char *fmt, ...)) 105 GCC_FUNC_ATTR2(noreturn, format(printf, 1, 2)); 106 void warningf ARGS((int fileline, const char *fmt, ...)) 107 GCC_FUNC_ATTR(format(printf, 2, 3)); 108 void bi_errorf ARGS((const char *fmt, ...)) 109 GCC_FUNC_ATTR(format(printf, 1, 2)); 110 void internal_errorf ARGS((int jump, const char *fmt, ...)) 111 GCC_FUNC_ATTR(format(printf, 2, 3)); 112 void error_prefix ARGS((int fileline)); 113 void shellf ARGS((const char *fmt, ...)) 114 GCC_FUNC_ATTR(format(printf, 1, 2)); 115 void shprintf ARGS((const char *fmt, ...)) 116 GCC_FUNC_ATTR(format(printf, 1, 2)); 117 #ifdef KSH_DEBUG 118 void kshdebug_init_ ARGS((void)); 119 void kshdebug_printf_ ARGS((const char *fmt, ...)) 120 GCC_FUNC_ATTR(format(printf, 1, 2)); 121 void kshdebug_dump_ ARGS((const char *str, const void *mem, int nbytes)); 122 #endif /* KSH_DEBUG */ 123 int can_seek ARGS((int fd)); 124 void initio ARGS((void)); 125 int ksh_dup2 ARGS((int ofd, int nfd, int errok)); 126 int savefd ARGS((int fd, int noclose)); 127 void restfd ARGS((int fd, int ofd)); 128 void openpipe ARGS((int *pv)); 129 void closepipe ARGS((int *pv)); 130 int check_fd ARGS((char *name, int mode, const char **emsgp)); 131 #ifdef KSH 132 void coproc_init ARGS((void)); 133 void coproc_read_close ARGS((int fd)); 134 void coproc_readw_close ARGS((int fd)); 135 void coproc_write_close ARGS((int fd)); 136 int coproc_getfd ARGS((int mode, const char **emsgp)); 137 void coproc_cleanup ARGS((int reuse)); 138 #endif /* KSH */ 139 struct temp *maketemp ARGS((Area *ap, Temp_type type, struct temp **tlist)); 140 /* jobs.c */ 141 void j_init ARGS((int mflagset)); 142 void j_exit ARGS((void)); 143 void j_change ARGS((void)); 144 int exchild ARGS((struct op *t, int flags, int close_fd)); 145 void startlast ARGS((void)); 146 int waitlast ARGS((void)); 147 int waitfor ARGS((const char *cp, int *sigp)); 148 int j_kill ARGS((const char *cp, int sig)); 149 int j_resume ARGS((const char *cp, int bg)); 150 int j_jobs ARGS((const char *cp, int slp, int nflag)); 151 void j_notify ARGS((void)); 152 pid_t j_async ARGS((void)); 153 int j_stopped_running ARGS((void)); 154 /* lex.c */ 155 int yylex ARGS((int cf)); 156 void yyerror ARGS((const char *fmt, ...)) 157 GCC_FUNC_ATTR2(noreturn, format(printf, 1, 2)); 158 Source * pushs ARGS((int type, Area *areap)); 159 void set_prompt ARGS((int to, Source *s)); 160 void pprompt ARGS((const char *cp, int ntruncate)); 161 /* mail.c */ 162 #ifdef KSH 163 void mcheck ARGS((void)); 164 void mcset ARGS((long interval)); 165 void mbset ARGS((char *p)); 166 void mpset ARGS((char *mptoparse)); 167 #endif /* KSH */ 168 /* main.c */ 169 int include ARGS((const char *name, int argc, char **argv, 170 int intr_ok)); 171 int command ARGS((const char *comm)); 172 int shell ARGS((Source *volatile s, int volatile toplevel)); 173 void unwind ARGS((int i)) GCC_FUNC_ATTR(noreturn); 174 void newenv ARGS((int type)); 175 void quitenv ARGS((void)); 176 void cleanup_parents_env ARGS((void)); 177 void cleanup_proc_env ARGS((void)); 178 void aerror ARGS((Area *ap, const char *msg)) 179 GCC_FUNC_ATTR(noreturn); 180 /* misc.c */ 181 void setctypes ARGS((const char *s, int t)); 182 void initctypes ARGS((void)); 183 char * ulton ARGS((unsigned long n, int base)); 184 char * str_save ARGS((const char *s, Area *ap)); 185 char * str_nsave ARGS((const char *s, int n, Area *ap)); 186 int option ARGS((const char *n)); 187 char * getoptions ARGS((void)); 188 void change_flag ARGS((enum sh_flag f, int what, int newval)); 189 int parse_args ARGS((char **argv, int what, int *setargsp)); 190 int getn ARGS((const char *as, int *ai)); 191 int bi_getn ARGS((const char *as, int *ai)); 192 int gmatch ARGS((const char *s, const char *p, int isfile)); 193 int has_globbing ARGS((const char *xp, const char *xpe)); 194 const unsigned char *pat_scan ARGS((const unsigned char *p, 195 const unsigned char *pe, int match_sep)); 196 void qsortp ARGS((void **base, size_t n, int (*f)(void *, void *))); 197 int xstrcmp ARGS((void *p1, void *p2)); 198 void ksh_getopt_reset ARGS((Getopt *go, int)); 199 int ksh_getopt ARGS((char **argv, Getopt *go, const char *options)); 200 void print_value_quoted ARGS((const char *s)); 201 void print_columns ARGS((struct shf *shf, int n, 202 char *(*func)(void *, int, char *, int), 203 void *arg, int max_width, int prefcol)); 204 int strip_nuls ARGS((char *buf, int nbytes)); 205 char *str_zcpy ARGS((char *dst, const char *src, int dsize)); 206 int blocking_read ARGS((int fd, char *buf, int nbytes)); 207 int reset_nonblock ARGS((int fd)); 208 char *ksh_get_wd ARGS((char *buf, int bsize)); 209 /* path.c */ 210 int make_path ARGS((const char *cwd, const char *file, 211 char **pathlist, XString *xsp, int *phys_pathp)); 212 void simplify_path ARGS((char *path)); 213 char *get_phys_path ARGS((const char *path)); 214 void set_current_wd ARGS((char *path)); 215 /* syn.c */ 216 void initkeywords ARGS((void)); 217 struct op * compile ARGS((Source *s)); 218 /* table.c */ 219 unsigned int hash ARGS((const char *n)); 220 void tinit ARGS((struct table *tp, Area *ap, int tsize)); 221 struct tbl * tsearch ARGS((struct table *tp, const char *n, unsigned int h)); 222 struct tbl * tenter ARGS((struct table *tp, const char *n, unsigned int h)); 223 void tdelete ARGS((struct tbl *p)); 224 void twalk ARGS((struct tstate *ts, struct table *tp)); 225 struct tbl * tnext ARGS((struct tstate *ts)); 226 struct tbl ** tsort ARGS((struct table *tp)); 227 /* trace.c */ 228 /* trap.c */ 229 void inittraps ARGS((void)); 230 #ifdef KSH 231 void alarm_init ARGS((void)); 232 #endif /* KSH */ 233 Trap * gettrap ARGS((const char *name, int igncase)); 234 RETSIGTYPE trapsig ARGS((int i)); 235 void intrcheck ARGS((void)); 236 int fatal_trap_check ARGS((void)); 237 int trap_pending ARGS((void)); 238 void runtraps ARGS((int intr)); 239 void runtrap ARGS((Trap *p)); 240 void cleartraps ARGS((void)); 241 void restoresigs ARGS((void)); 242 void settrap ARGS((Trap *p, char *s)); 243 int block_pipe ARGS((void)); 244 void restore_pipe ARGS((int restore_dfl)); 245 int setsig ARGS((Trap *p, handler_t f, int flags)); 246 void setexecsig ARGS((Trap *p, int restore)); 247 /* tree.c */ 248 int fptreef ARGS((struct shf *f, int indent, const char *fmt, ...)); 249 char * snptreef ARGS((char *s, int n, const char *fmt, ...)); 250 struct op * tcopy ARGS((struct op *t, Area *ap)); 251 char * wdcopy ARGS((const char *wp, Area *ap)); 252 char * wdscan ARGS((const char *wp, int c)); 253 char * wdstrip ARGS((const char *wp)); 254 void tfree ARGS((struct op *t, Area *ap)); 255 /* var.c */ 256 void newblock ARGS((void)); 257 void popblock ARGS((void)); 258 void initvar ARGS((void)); 259 struct tbl * global ARGS((const char *n)); 260 struct tbl * local ARGS((const char *n, bool_t copy)); 261 char * str_val ARGS((struct tbl *vp)); 262 long intval ARGS((struct tbl *vp)); 263 int setstr ARGS((struct tbl *vq, const char *s, int error_ok)); 264 struct tbl *setint_v ARGS((struct tbl *vq, struct tbl *vp)); 265 void setint ARGS((struct tbl *vq, long n)); 266 int getint ARGS((struct tbl *vp, long *nump)); 267 struct tbl * typeset ARGS((const char *var, Tflag set, Tflag clr, int field, int base)); 268 void unset ARGS((struct tbl *vp, int array_ref)); 269 char * skip_varname ARGS((const char *s, int aok)); 270 char *skip_wdvarname ARGS((const char *s, int aok)); 271 int is_wdvarname ARGS((const char *s, int aok)); 272 int is_wdvarassign ARGS((const char *s)); 273 char ** makenv ARGS((void)); 274 void change_random ARGS((void)); 275 int array_ref_len ARGS((const char *cp)); 276 char * arrayname ARGS((const char *str)); 277 void set_array ARGS((const char *var, int reset, char **vals)); 278 /* version.c */ 279 /* vi.c: see edit.h */ 280 281 282 /* Hack to avoid billions of compile warnings on SunOS 4.1.x */ 283 #if defined(MUN) && defined(sun) && !defined(__svr4__) 284 extern void bcopy ARGS((const void *src, void *dst, size_t size)); 285 extern int fclose ARGS((FILE *fp)); 286 extern int fprintf ARGS((FILE *fp, const char *fmt, ...)); 287 extern int fread ARGS((void *buf, int size, int num, FILE *fp)); 288 extern int ioctl ARGS((int fd, int request, void *arg)); 289 extern int killpg ARGS((int pgrp, int sig)); 290 extern int nice ARGS((int n)); 291 extern int readlink ARGS((const char *path, char *buf, int bufsize)); 292 extern int setpgrp ARGS((int pid, int pgrp)); 293 extern int strcasecmp ARGS((const char *s1, const char *s2)); 294 extern int tolower ARGS((int)); 295 extern int toupper ARGS((int)); 296 /* Include files aren't included yet */ 297 extern int getrlimit ARGS(( /* int resource, struct rlimit *rpl */ )); 298 extern int getrusage ARGS(( /* int who, struct rusage *rusage */ )); 299 extern int gettimeofday ARGS(( /* struct timeval *tv, struct timezone *tz */ )); 300 extern int setrlimit ARGS(( /* int resource, struct rlimit *rlp */ )); 301 extern int lstat ARGS(( /* const char *path, struct stat *buf */ )); 302 #endif 303