X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/5fe577adc4ebb978dff0d583622ecc9f5bf2e20c..4df6491c77d191519a5bc3b20a86c9bd6c8078a0:/usr/src/bin/csh/init.c diff --git a/usr/src/bin/csh/init.c b/usr/src/bin/csh/init.c index 78f16227ef..7c707cfe4d 100644 --- a/usr/src/bin/csh/init.c +++ b/usr/src/bin/csh/init.c @@ -1,224 +1,142 @@ -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley Software License Agreement - * specifies the terms and conditions for redistribution. +/*- + * Copyright (c) 1980, 1991 The Regents of the University of California. + * All rights reserved. + * + * %sccs.include.redist.c% */ #ifndef lint -static char *sccsid = "@(#)init.c 5.4 (Berkeley) %G%"; -#endif - -#include "sh.local.h" - -/* - * C shell - */ +static char sccsid[] = "@(#)init.c 5.11 (Berkeley) %G%"; +#endif /* not lint */ -extern int doalias(); -extern int dobg(); -extern int dobreak(); -extern int dochngd(); -extern int docontin(); -extern int dodirs(); -extern int doecho(); -extern int doelse(); -extern int doend(); -extern int doendif(); -extern int doendsw(); -extern int doeval(); -extern int doexit(); -extern int dofg(); -extern int doforeach(); -extern int doglob(); -extern int dogoto(); -extern int dohash(); -extern int dohist(); -extern int doif(); -extern int dojobs(); -extern int dokill(); -extern int dolet(); -extern int dolimit(); -extern int dologin(); -extern int dologout(); -extern int donice(); -extern int donotify(); -extern int donohup(); -extern int doonintr(); -extern int dopopd(); -extern int dopushd(); -extern int dorepeat(); -extern int doset(); -extern int dosetenv(); -extern int dosource(); -extern int dostop(); -extern int dosuspend(); -extern int doswbrk(); -extern int doswitch(); -extern int dotime(); -extern int dounlimit(); -extern int doumask(); -extern int dowait(); -extern int dowhile(); -extern int dozip(); -extern int execash(); -extern int goodbye(); -#ifdef VFORK -extern int hashstat(); +#if __STDC__ +# include +#else +# include #endif -extern int shift(); -extern int showall(); -extern int unalias(); -extern int dounhash(); -extern int unset(); -extern int dounsetenv(); + +#include "csh.h" +#include "extern.h" #define INF 1000 -struct biltins { - char *bname; - int (*bfunct)(); - short minargs, maxargs; -} bfunc[] = { - "@", dolet, 0, INF, - "alias", doalias, 0, INF, - "alloc", showall, 0, 1, - "bg", dobg, 0, INF, - "break", dobreak, 0, 0, - "breaksw", doswbrk, 0, 0, - "case", dozip, 0, 1, - "cd", dochngd, 0, 1, - "chdir", dochngd, 0, 1, - "continue", docontin, 0, 0, - "default", dozip, 0, 0, - "dirs", dodirs, 0, 1, - "echo", doecho, 0, INF, - "else", doelse, 0, INF, - "end", doend, 0, 0, - "endif", dozip, 0, 0, - "endsw", dozip, 0, 0, - "eval", doeval, 0, INF, - "exec", execash, 1, INF, - "exit", doexit, 0, INF, - "fg", dofg, 0, INF, - "foreach", doforeach, 3, INF, - "glob", doglob, 0, INF, - "goto", dogoto, 1, 1, -#ifdef VFORK - "hashstat", hashstat, 0, 0, -#endif - "history", dohist, 0, 2, - "if", doif, 1, INF, - "jobs", dojobs, 0, 1, - "kill", dokill, 1, INF, - "limit", dolimit, 0, 3, - "login", dologin, 0, 1, - "logout", dologout, 0, 0, - "nice", donice, 0, INF, - "nohup", donohup, 0, INF, - "notify", donotify, 0, INF, - "onintr", doonintr, 0, 2, - "popd", dopopd, 0, 1, - "pushd", dopushd, 0, 1, - "rehash", dohash, 0, 0, - "repeat", dorepeat, 2, INF, - "set", doset, 0, INF, - "setenv", dosetenv, 0, 2, - "shift", shift, 0, 1, - "source", dosource, 1, 2, - "stop", dostop, 1, INF, - "suspend", dosuspend, 0, 0, - "switch", doswitch, 1, INF, - "time", dotime, 0, INF, - "umask", doumask, 0, 1, - "unalias", unalias, 1, INF, - "unhash", dounhash, 0, 0, - "unlimit", dounlimit, 0, INF, - "unset", unset, 1, INF, - "unsetenv", dounsetenv, 1, INF, - "wait", dowait, 0, 0, - "while", dowhile, 1, INF, +struct biltins bfunc[] = +{ + "@", dolet, 0, INF, + "alias", doalias, 0, INF, + "alloc", showall, 0, 1, + "bg", dobg, 0, INF, + "break", dobreak, 0, 0, + "breaksw", doswbrk, 0, 0, + "case", dozip, 0, 1, + "cd", dochngd, 0, INF, + "chdir", dochngd, 0, INF, + "continue", docontin, 0, 0, + "default", dozip, 0, 0, + "dirs", dodirs, 0, INF, + "echo", doecho, 0, INF, + "else", doelse, 0, INF, + "end", doend, 0, 0, + "endif", dozip, 0, 0, + "endsw", dozip, 0, 0, + "eval", doeval, 0, INF, + "exec", execash, 1, INF, + "exit", doexit, 0, INF, + "fg", dofg, 0, INF, + "foreach", doforeach, 3, INF, + "glob", doglob, 0, INF, + "goto", dogoto, 1, 1, + "hashstat", hashstat, 0, 0, + "history", dohist, 0, 2, + "if", doif, 1, INF, + "jobs", dojobs, 0, 1, + "kill", dokill, 1, INF, + "limit", dolimit, 0, 3, + "linedit", doecho, 0, INF, + "login", dologin, 0, 1, + "logout", dologout, 0, 0, + "nice", donice, 0, INF, + "nohup", donohup, 0, INF, + "notify", donotify, 0, INF, + "onintr", doonintr, 0, 2, + "popd", dopopd, 0, INF, + "pushd", dopushd, 0, INF, + "rehash", dohash, 0, 0, + "repeat", dorepeat, 2, INF, + "set", doset, 0, INF, + "setenv", dosetenv, 0, 2, + "shift", shift, 0, 1, + "source", dosource, 1, 2, + "stop", dostop, 1, INF, + "suspend", dosuspend, 0, 0, + "switch", doswitch, 1, INF, + "time", dotime, 0, INF, + "umask", doumask, 0, 1, + "unalias", unalias, 1, INF, + "unhash", dounhash, 0, 0, + "unlimit", dounlimit, 0, INF, + "unset", unset, 1, INF, + "unsetenv", dounsetenv, 1, INF, + "wait", dowait, 0, 0, + "while", dowhile, 1, INF, }; -int nbfunc = sizeof bfunc / sizeof *bfunc; - -#define ZBREAK 0 -#define ZBRKSW 1 -#define ZCASE 2 -#define ZDEFAULT 3 -#define ZELSE 4 -#define ZEND 5 -#define ZENDIF 6 -#define ZENDSW 7 -#define ZEXIT 8 -#define ZFOREACH 9 -#define ZGOTO 10 -#define ZIF 11 -#define ZLABEL 12 -#define ZLET 13 -#define ZSET 14 -#define ZSWITCH 15 -#define ZTEST 16 -#define ZTHEN 17 -#define ZWHILE 18 +int nbfunc = sizeof bfunc / sizeof *bfunc; -struct srch { - char *s_name; - short s_value; -} srchn[] = { - "@", ZLET, - "break", ZBREAK, - "breaksw", ZBRKSW, - "case", ZCASE, - "default", ZDEFAULT, - "else", ZELSE, - "end", ZEND, - "endif", ZENDIF, - "endsw", ZENDSW, - "exit", ZEXIT, - "foreach", ZFOREACH, - "goto", ZGOTO, - "if", ZIF, - "label", ZLABEL, - "set", ZSET, - "switch", ZSWITCH, - "while", ZWHILE, +struct srch srchn[] = +{ + "@", T_LET, + "break", T_BREAK, + "breaksw", T_BRKSW, + "case", T_CASE, + "default", T_DEFAULT, + "else", T_ELSE, + "end", T_END, + "endif", T_ENDIF, + "endsw", T_ENDSW, + "exit", T_EXIT, + "foreach", T_FOREACH, + "goto", T_GOTO, + "if", T_IF, + "label", T_LABEL, + "set", T_SET, + "switch", T_SWITCH, + "while", T_WHILE, }; -int nsrchn = sizeof srchn / sizeof *srchn; +int nsrchn = sizeof srchn / sizeof *srchn; -struct mesg { - char *iname; - char *pname; -} mesg[] = { - 0, 0, - "HUP", "Hangup", - "INT", "Interrupt", - "QUIT", "Quit", - "ILL", "Illegal instruction", - "TRAP", "Trace/BPT trap", - "IOT", "IOT trap", - "EMT", "EMT trap", - "FPE", "Floating exception", - "KILL", "Killed", - "BUS", "Bus error", - "SEGV", "Segmentation fault", - "SYS", "Bad system call", - "PIPE", "Broken pipe", - "ALRM", "Alarm clock", - "TERM", "Terminated", - "URG", "Urgent I/O condition", - "STOP", "Suspended (signal)", - "TSTP", "Suspended", - "CONT", "Continued", - "CHLD", "Child exited", - "TTIN", "Suspended (tty input)", - "TTOU", "Suspended (tty output)", - "IO", "I/O possible", - "XCPU", "Cputime limit exceeded", - "XFSZ", "Filesize limit exceeded", - "VTALRM","Virtual timer expired", - "PROF", "Profiling timer expired", - "WINCH","Window size changed", - 0, "Signal 29", - "USR1", "User defined signal 1", - "USR2", "User defined signal 2", - 0, "Signal 32" +struct mesg mesg[] = +{ + /* 0 */ 0, "", + /* 1 */ "HUP", "Hangup", + /* 2 */ "INT", "Interrupt", + /* 3 */ "QUIT", "Quit", + /* 4 */ "ILL", "Illegal instruction", + /* 5 */ "TRAP", "Trace/BPT trap", + /* 6 */ "IOT", "IOT trap", + /* 7 */ "EMT", "EMT trap", + /* 8 */ "FPE", "Floating exception", + /* 9 */ "KILL", "Killed", + /* 10 */ "BUS", "Bus error", + /* 11 */ "SEGV", "Segmentation fault", + /* 12 */ "SYS", "Bad system call", + /* 13 */ "PIPE", "Broken pipe", + /* 14 */ "ALRM", "Alarm clock", + /* 15 */ "TERM", "Terminated", + /* 16 */ "URG", "Urgent condition on IO channel", + /* 17 */ "STOP", "Suspended (signal)", + /* 18 */ "TSTP", "Suspended", + /* 19 */ "CONT", "Continued", + /* 20 */ "CHLD", "Child exited", + /* 21 */ "TTIN", "Suspended (tty input)", + /* 22 */ "TTOU", "Suspended (tty output)", + /* 23 */ "IO", "IO possible interrupt", + /* 24 */ "XCPU", "Cputime limit exceeded", + /* 25 */ "XFSZ", "Filesize limit exceeded", + /* 26 */ "VTALRM", "Virtual time alarm", + /* 27 */ "PROF", "Profiling time alarm", + /* 28 */ "WINCH", "Window changed", + /* 29 */ "INFO", "Information request", + /* 30 */ "USR1", "User signal 1", + /* 31 */ "USR2", "User signal 2", + /* 32 */ 0, "Signal 32", };