1*822c36bbSkamil /* $NetBSD: proto.h,v 1.13 2018/06/03 12:18:29 kamil Exp $ */ 22ab2e20cStls 3e1b2664cSjtc /* 4e1b2664cSjtc * prototypes for PD-KSH 5e1b2664cSjtc * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang " 6*822c36bbSkamil * $Id: proto.h,v 1.13 2018/06/03 12:18:29 kamil Exp $ 7e1b2664cSjtc */ 8e1b2664cSjtc 913351aa1Skamil #include <stdbool.h> 1013351aa1Skamil 11e1b2664cSjtc /* alloc.c */ 12a397ec1fSchristos Area * ainit ARGS((Area *)); 13a397ec1fSchristos void afreeall ARGS((Area *)); 14a397ec1fSchristos void * alloc ARGS((size_t, Area *)); 15a397ec1fSchristos void * aresize ARGS((void *, size_t, Area *)); 16a397ec1fSchristos void afree ARGS((void *, Area *)); 17e1b2664cSjtc /* c_ksh.c */ 18a397ec1fSchristos int c_hash ARGS((char **)); 19a397ec1fSchristos int c_cd ARGS((char **)); 20a397ec1fSchristos int c_pwd ARGS((char **)); 21a397ec1fSchristos int c_print ARGS((char **)); 22a397ec1fSchristos int c_whence ARGS((char **)); 23a397ec1fSchristos int c_command ARGS((char **)); 24a397ec1fSchristos int c_typeset ARGS((char **)); 25a397ec1fSchristos int c_alias ARGS((char **)); 26a397ec1fSchristos int c_unalias ARGS((char **)); 27a397ec1fSchristos int c_let ARGS((char **)); 28a397ec1fSchristos int c_jobs ARGS((char **)); 29a397ec1fSchristos int c_fgbg ARGS((char **)); 30a397ec1fSchristos int c_kill ARGS((char **)); 31a397ec1fSchristos void getopts_reset ARGS((int)); 32a397ec1fSchristos int c_getopts ARGS((char **)); 33a397ec1fSchristos int c_bind ARGS((char **)); 34e1b2664cSjtc /* c_sh.c */ 35a397ec1fSchristos int c_label ARGS((char **)); 36a397ec1fSchristos int c_shift ARGS((char **)); 37a397ec1fSchristos int c_umask ARGS((char **)); 38a397ec1fSchristos int c_dot ARGS((char **)); 39a397ec1fSchristos int c_wait ARGS((char **)); 40a397ec1fSchristos int c_read ARGS((char **)); 41a397ec1fSchristos int c_eval ARGS((char **)); 42a397ec1fSchristos int c_trap ARGS((char **)); 43a397ec1fSchristos int c_brkcont ARGS((char **)); 44a397ec1fSchristos int c_exitreturn ARGS((char **)); 45a397ec1fSchristos int c_set ARGS((char **)); 46a397ec1fSchristos int c_unset ARGS((char **)); 47a397ec1fSchristos int c_ulimit ARGS((char **)); 48a397ec1fSchristos int c_times ARGS((char **)); 49a397ec1fSchristos int timex ARGS((struct op *, int)); 50a397ec1fSchristos void timex_hook ARGS((struct op *, char ** volatile *)); 51a397ec1fSchristos int c_exec ARGS((char **)); 52a397ec1fSchristos int c_builtin ARGS((char **)); 53e1b2664cSjtc /* c_test.c */ 54a397ec1fSchristos int c_test ARGS((char **)); 55e1b2664cSjtc /* edit.c: most prototypes in edit.h */ 56e1b2664cSjtc void x_init ARGS((void)); 57a397ec1fSchristos int x_read ARGS((char *, size_t)); 58a397ec1fSchristos void set_editmode ARGS((const char *)); 59e1b2664cSjtc /* emacs.c: most prototypes in edit.h */ 60a397ec1fSchristos int x_bind ARGS((const char *, const char *, int, int)); 61e1b2664cSjtc /* eval.c */ 62a397ec1fSchristos char * substitute ARGS((const char *, int)); 63a397ec1fSchristos char ** eval ARGS((char **, int)); 64a397ec1fSchristos char * evalstr ARGS((char *, int)); 65a397ec1fSchristos char * evalonestr ARGS((char *, int)); 66a397ec1fSchristos char *debunk ARGS((char *, const char *, size_t)); 67a397ec1fSchristos void expand ARGS((char *, XPtrV *, int)); 68a397ec1fSchristos int glob_str ARGS((char *, XPtrV *, int)); 69e1b2664cSjtc /* exec.c */ 70a397ec1fSchristos int fd_clexec ARGS((int)); 71a397ec1fSchristos int execute ARGS((struct op * volatile, volatile int)); 72a397ec1fSchristos int shcomexec ARGS((char **)); 73a397ec1fSchristos struct tbl * findfunc ARGS((const char *, unsigned int, int)); 74a397ec1fSchristos int define ARGS((const char *, struct op *)); 75a397ec1fSchristos void builtin ARGS((const char *, int (*)(char **))); 76a397ec1fSchristos struct tbl * findcom ARGS((const char *, int)); 77e1b2664cSjtc void flushcom ARGS((int all)); 78a397ec1fSchristos char * search ARGS((const char *, const char *, int, int *)); 79a397ec1fSchristos int search_access ARGS((const char *, int, int *)); 80a397ec1fSchristos int pr_menu ARGS((char *const *)); 81a397ec1fSchristos int pr_list ARGS((char *const *)); 82e1b2664cSjtc /* expr.c */ 83a397ec1fSchristos int evaluate ARGS((const char *, long *, int)); 84a397ec1fSchristos int v_evaluate ARGS((struct tbl *, const char *, volatile int)); 85e1b2664cSjtc /* history.c */ 86e1b2664cSjtc void init_histvec ARGS((void)); 87a397ec1fSchristos void hist_init ARGS((Source *)); 88e1b2664cSjtc void hist_finish ARGS((void)); 89a397ec1fSchristos void histsave ARGS((int, const char *, int)); 90e1b2664cSjtc #ifdef HISTORY 91a397ec1fSchristos int c_fc ARGS((char **)); 92a397ec1fSchristos void sethistsize ARGS((int)); 93a397ec1fSchristos void sethistfile ARGS((const char *)); 94e1b2664cSjtc # ifdef EASY_HISTORY 95a397ec1fSchristos void histappend ARGS((const char *, int)); 96e1b2664cSjtc # endif 97e1b2664cSjtc char ** histpos ARGS((void)); 98e1b2664cSjtc int histN ARGS((void)); 99a397ec1fSchristos int histnum ARGS((int)); 100a397ec1fSchristos int findhist ARGS((int, int, const char *, int)); 101e1b2664cSjtc #endif /* HISTORY */ 102e1b2664cSjtc /* io.c */ 103a397ec1fSchristos void errorf ARGS((const char *, ...)) 104e1b2664cSjtc GCC_FUNC_ATTR2(noreturn, format(printf, 1, 2)); 105a397ec1fSchristos void warningf ARGS((int, const char *, ...)) 106e1b2664cSjtc GCC_FUNC_ATTR(format(printf, 2, 3)); 107a397ec1fSchristos void bi_errorf ARGS((const char *, ...)) 108e1b2664cSjtc GCC_FUNC_ATTR(format(printf, 1, 2)); 109a397ec1fSchristos void internal_errorf ARGS((int, const char *, ...)) 110e1b2664cSjtc GCC_FUNC_ATTR(format(printf, 2, 3)); 111a397ec1fSchristos void error_prefix ARGS((int)); 112a397ec1fSchristos void shellf ARGS((const char *, ...)) 113e1b2664cSjtc GCC_FUNC_ATTR(format(printf, 1, 2)); 114a397ec1fSchristos void shprintf ARGS((const char *, ...)) 115e1b2664cSjtc GCC_FUNC_ATTR(format(printf, 1, 2)); 11648ee8d12Shubertf #ifdef KSH_DEBUG 11748ee8d12Shubertf void kshdebug_init_ ARGS((void)); 118a397ec1fSchristos void kshdebug_printf_ ARGS((const char *, ...)) 11948ee8d12Shubertf GCC_FUNC_ATTR(format(printf, 1, 2)); 120a397ec1fSchristos void kshdebug_dump_ ARGS((const char *, const void *, int)); 12148ee8d12Shubertf #endif /* KSH_DEBUG */ 122a397ec1fSchristos int can_seek ARGS((int)); 123e1b2664cSjtc void initio ARGS((void)); 124a397ec1fSchristos int ksh_dup2 ARGS((int, int, int)); 125a397ec1fSchristos int savefd ARGS((int, int)); 126a397ec1fSchristos void restfd ARGS((int, int)); 127a397ec1fSchristos void openpipe ARGS((int *)); 128a397ec1fSchristos void closepipe ARGS((int *)); 129a397ec1fSchristos int check_fd ARGS((char *, int, const char **)); 130e1b2664cSjtc #ifdef KSH 131e1b2664cSjtc void coproc_init ARGS((void)); 132a397ec1fSchristos void coproc_read_close ARGS((int)); 133a397ec1fSchristos void coproc_readw_close ARGS((int)); 134a397ec1fSchristos void coproc_write_close ARGS((int)); 135a397ec1fSchristos int coproc_getfd ARGS((int, const char **)); 136a397ec1fSchristos void coproc_cleanup ARGS((int)); 137e1b2664cSjtc #endif /* KSH */ 138a397ec1fSchristos struct temp *maketemp ARGS((Area *, Temp_type, struct temp **)); 139e1b2664cSjtc /* jobs.c */ 140a397ec1fSchristos void j_init ARGS((int)); 141e1b2664cSjtc void j_exit ARGS((void)); 142e1b2664cSjtc void j_change ARGS((void)); 143a397ec1fSchristos int exchild ARGS((struct op *, int, int)); 144e1b2664cSjtc void startlast ARGS((void)); 145e1b2664cSjtc int waitlast ARGS((void)); 146a397ec1fSchristos int waitfor ARGS((const char *, int *)); 147a397ec1fSchristos int j_kill ARGS((const char *, int)); 148a397ec1fSchristos int j_resume ARGS((const char *, int)); 149a397ec1fSchristos int j_jobs ARGS((const char *, int, int)); 150e1b2664cSjtc void j_notify ARGS((void)); 151e1b2664cSjtc pid_t j_async ARGS((void)); 152e1b2664cSjtc int j_stopped_running ARGS((void)); 153e1b2664cSjtc /* lex.c */ 154a397ec1fSchristos int yylex ARGS((int)); 155a397ec1fSchristos void yyerror ARGS((const char *, ...)) 156e1b2664cSjtc GCC_FUNC_ATTR2(noreturn, format(printf, 1, 2)); 157a397ec1fSchristos Source * pushs ARGS((int, Area *)); 158a397ec1fSchristos void set_prompt ARGS((int, Source *)); 159a397ec1fSchristos void pprompt ARGS((const char *, int)); 160e1b2664cSjtc /* mail.c */ 161e1b2664cSjtc #ifdef KSH 162e1b2664cSjtc void mcheck ARGS((void)); 163a397ec1fSchristos void mcset ARGS((long)); 164a397ec1fSchristos void mbset ARGS((char *)); 165a397ec1fSchristos void mpset ARGS((char *)); 166e1b2664cSjtc #endif /* KSH */ 167e1b2664cSjtc /* main.c */ 168a397ec1fSchristos int include ARGS((const char *, int, char **, int)); 169a397ec1fSchristos int command ARGS((const char *)); 170a397ec1fSchristos int shell ARGS((Source *volatile, int volatile)); 171a397ec1fSchristos void unwind ARGS((int)) GCC_FUNC_ATTR(noreturn); 172a397ec1fSchristos void newenv ARGS((int)); 173e1b2664cSjtc void quitenv ARGS((void)); 174e1b2664cSjtc void cleanup_parents_env ARGS((void)); 175614eee46Sjtc void cleanup_proc_env ARGS((void)); 176a397ec1fSchristos void aerror ARGS((Area *, const char *)) 177e1b2664cSjtc GCC_FUNC_ATTR(noreturn); 178e1b2664cSjtc /* misc.c */ 179a397ec1fSchristos void setctypes ARGS((const char *, int)); 180e1b2664cSjtc void initctypes ARGS((void)); 181a397ec1fSchristos char * ulton ARGS((unsigned long, int)); 182a397ec1fSchristos char * str_save ARGS((const char *, Area *)); 183a397ec1fSchristos char * str_nsave ARGS((const char *, int, Area *)); 184a397ec1fSchristos int option ARGS((const char *)); 185e1b2664cSjtc char * getoptions ARGS((void)); 186a397ec1fSchristos void change_flag ARGS((enum sh_flag, int, int)); 187a397ec1fSchristos int parse_args ARGS((char **v, int what, int *)); 188a397ec1fSchristos int getn ARGS((const char *, int *)); 189a397ec1fSchristos int bi_getn ARGS((const char *, int *)); 190a397ec1fSchristos int gmatch ARGS((const char *, const char *, int)); 191a397ec1fSchristos int has_globbing ARGS((const char *, const char *)); 192a397ec1fSchristos const unsigned char *pat_scan ARGS((const unsigned char *, 193a397ec1fSchristos const unsigned char *, int)); 194a397ec1fSchristos void qsortp ARGS((void **, size_t, int (*)(void *, void *))); 195a397ec1fSchristos int xstrcmp ARGS((void *, void *)); 196a397ec1fSchristos void ksh_getopt_reset ARGS((Getopt *, int)); 197a397ec1fSchristos int ksh_getopt ARGS((char **, Getopt *, const char *)); 198a397ec1fSchristos void print_value_quoted ARGS((const char *)); 199a397ec1fSchristos void print_columns ARGS((struct shf *, int, 200a397ec1fSchristos char *(*)(void *, int, char *, int), 201a397ec1fSchristos void *, int, int)); 202a397ec1fSchristos int strip_nuls ARGS((char *, int)); 203a397ec1fSchristos char *str_zcpy ARGS((char *, const char *, int)); 204a397ec1fSchristos int blocking_read ARGS((int, char *, int)); 205a397ec1fSchristos int reset_nonblock ARGS((int)); 206a397ec1fSchristos char *ksh_get_wd ARGS((char *, int)); 207e1b2664cSjtc /* path.c */ 208a397ec1fSchristos int make_path ARGS((const char *, const char *, 209a397ec1fSchristos char **, XString *, int *)); 210a397ec1fSchristos void simplify_path ARGS((char *)); 211a397ec1fSchristos char *get_phys_path ARGS((const char *)); 212a397ec1fSchristos void set_current_wd ARGS((char *)); 213e1b2664cSjtc /* syn.c */ 214e1b2664cSjtc void initkeywords ARGS((void)); 215a397ec1fSchristos struct op * compile ARGS((Source *)); 216e1b2664cSjtc /* table.c */ 217a397ec1fSchristos unsigned int hash ARGS((const char *)); 218a397ec1fSchristos void tinit ARGS((struct table *, Area *, int)); 219ed120974Skamil struct tbl * mytsearch ARGS((struct table *, const char *, unsigned int)); 220a397ec1fSchristos struct tbl * tenter ARGS((struct table *, const char *, unsigned int)); 221a1e1dcf1Skamil void mytdelete ARGS((struct tbl *)); 222*822c36bbSkamil void ksh_twalk ARGS((struct tstate *, struct table *)); 223a397ec1fSchristos struct tbl * tnext ARGS((struct tstate *)); 224a397ec1fSchristos struct tbl ** tsort ARGS((struct table *)); 225e1b2664cSjtc /* trace.c */ 226e1b2664cSjtc /* trap.c */ 227e1b2664cSjtc void inittraps ARGS((void)); 228e1b2664cSjtc #ifdef KSH 229e1b2664cSjtc void alarm_init ARGS((void)); 230e1b2664cSjtc #endif /* KSH */ 231a397ec1fSchristos Trap * gettrap ARGS((const char *, int)); 232a397ec1fSchristos RETSIGTYPE trapsig ARGS((int)); 233e1b2664cSjtc void intrcheck ARGS((void)); 234e1b2664cSjtc int fatal_trap_check ARGS((void)); 235e1b2664cSjtc int trap_pending ARGS((void)); 236a397ec1fSchristos void runtraps ARGS((int)); 237a397ec1fSchristos void runtrap ARGS((Trap *)); 238e1b2664cSjtc void cleartraps ARGS((void)); 239e1b2664cSjtc void restoresigs ARGS((void)); 240a397ec1fSchristos void settrap ARGS((Trap *, char *)); 241e1b2664cSjtc int block_pipe ARGS((void)); 242a397ec1fSchristos void restore_pipe ARGS((int)); 243a397ec1fSchristos int setsig ARGS((Trap *, handler_t, int)); 244a397ec1fSchristos void setexecsig ARGS((Trap *, int)); 245e1b2664cSjtc /* tree.c */ 246a397ec1fSchristos int fptreef ARGS((struct shf *, int, const char *, ...)); 247a397ec1fSchristos char * snptreef ARGS((char *, int, const char *, ...)); 248a397ec1fSchristos struct op * tcopy ARGS((struct op *, Area *)); 249a397ec1fSchristos char * wdcopy ARGS((const char *, Area *)); 250a397ec1fSchristos char * wdscan ARGS((const char *, int)); 251a397ec1fSchristos char * wdstrip ARGS((const char *)); 252a397ec1fSchristos void tfree ARGS((struct op *, Area *)); 253e1b2664cSjtc /* var.c */ 254e1b2664cSjtc void newblock ARGS((void)); 255e1b2664cSjtc void popblock ARGS((void)); 256e1b2664cSjtc void initvar ARGS((void)); 257a397ec1fSchristos struct tbl * global ARGS((const char *)); 25859ca3945Sjoerg struct tbl * local(const char *, bool); 259a397ec1fSchristos char * str_val ARGS((struct tbl *)); 260a397ec1fSchristos long intval ARGS((struct tbl *)); 261a397ec1fSchristos int setstr ARGS((struct tbl *, const char *, int)); 262a397ec1fSchristos struct tbl *setint_v ARGS((struct tbl *, struct tbl *)); 263a397ec1fSchristos void setint ARGS((struct tbl *, long)); 264a397ec1fSchristos int getint ARGS((struct tbl *, long *)); 265a397ec1fSchristos struct tbl * typeset ARGS((const char *, Tflag, Tflag, int, int)); 266a397ec1fSchristos void unset ARGS((struct tbl *, int)); 267a397ec1fSchristos char * skip_varname ARGS((const char *, int)); 268a397ec1fSchristos char *skip_wdvarname ARGS((const char *, int)); 269a397ec1fSchristos int is_wdvarname ARGS((const char *, int)); 270a397ec1fSchristos int is_wdvarassign ARGS((const char *)); 271e1b2664cSjtc char ** makenv ARGS((void)); 27248ee8d12Shubertf void change_random ARGS((void)); 273a397ec1fSchristos int array_ref_len ARGS((const char *)); 274a397ec1fSchristos char * arrayname ARGS((const char *)); 275a397ec1fSchristos void set_array ARGS((const char *, int, char **)); 276e1b2664cSjtc /* version.c */ 277e1b2664cSjtc /* vi.c: see edit.h */ 278