1: static char *sccsid = "@(#)sh.init.c 4.1 10/9/80"; 2: 3: #include "sh.local.h" 4: 5: /* 6: * C shell 7: */ 8: 9: extern int doalias(); 10: extern int dobg(); 11: extern int dobreak(); 12: extern int dochngd(); 13: extern int docontin(); 14: extern int dodirs(); 15: extern int doecho(); 16: extern int doelse(); 17: extern int doend(); 18: extern int doendif(); 19: extern int doendsw(); 20: extern int doeval(); 21: extern int doexit(); 22: extern int dofg(); 23: extern int doforeach(); 24: extern int doglob(); 25: extern int dogoto(); 26: extern int dohash(); 27: extern int dohist(); 28: extern int doif(); 29: extern int dojobs(); 30: extern int dokill(); 31: extern int dolet(); 32: #ifdef LIMIT 33: extern int dolimit(); 34: #endif 35: extern int dologin(); 36: extern int dologout(); 37: extern int donewgrp(); 38: extern int donice(); 39: extern int donotify(); 40: extern int donohup(); 41: extern int doonintr(); 42: extern int dopopd(); 43: extern int dopushd(); 44: extern int dorepeat(); 45: extern int doset(); 46: extern int dosetenv(); 47: extern int dosource(); 48: extern int dostop(); 49: extern int dosuspend(); 50: extern int doswbrk(); 51: extern int doswitch(); 52: extern int dotime(); 53: #ifdef LIMIT 54: extern int dounlimit(); 55: #endif 56: extern int doumask(); 57: extern int dowait(); 58: extern int dowhile(); 59: extern int dozip(); 60: extern int execash(); 61: extern int goodbye(); 62: #ifdef VFORK 63: extern int hashstat(); 64: #endif 65: extern int shift(); 66: extern int showall(); 67: extern int unalias(); 68: extern int dounhash(); 69: extern int unset(); 70: extern int dounsetenv(); 71: 72: #define INF 1000 73: 74: struct biltins { 75: char *bname; 76: int (*bfunct)(); 77: short minargs, maxargs; 78: } bfunc[] = { 79: "@", dolet, 0, INF, 80: "alias", doalias, 0, INF, 81: #ifdef debug 82: "alloc", showall, 0, 1, 83: #endif 84: "bg", dobg, 0, INF, 85: "break", dobreak, 0, 0, 86: "breaksw", doswbrk, 0, 0, 87: #ifdef IIASA 88: "bye", goodbye, 0, 0, 89: #endif 90: "case", dozip, 0, 1, 91: "cd", dochngd, 0, 1, 92: "chdir", dochngd, 0, 1, 93: "continue", docontin, 0, 0, 94: "default", dozip, 0, 0, 95: "dirs", dodirs, 0, 1, 96: "echo", doecho, 0, INF, 97: "else", doelse, 0, INF, 98: "end", doend, 0, 0, 99: "endif", dozip, 0, 0, 100: "endsw", dozip, 0, 0, 101: "eval", doeval, 0, INF, 102: "exec", execash, 1, INF, 103: "exit", doexit, 0, INF, 104: "fg", dofg, 0, INF, 105: "foreach", doforeach, 3, INF, 106: #ifdef IIASA 107: "gd", dopushd, 0, 1, 108: #endif 109: "glob", doglob, 0, INF, 110: "goto", dogoto, 1, 1, 111: #ifdef VFORK 112: "hashstat", hashstat, 0, 0, 113: #endif 114: "history", dohist, 0, 2, 115: "if", doif, 1, INF, 116: "jobs", dojobs, 0, 1, 117: "kill", dokill, 1, INF, 118: #ifdef LIMIT 119: "limit", dolimit, 0, 3, 120: #endif 121: "login", dologin, 0, 1, 122: "logout", dologout, 0, 0, 123: "newgrp", donewgrp, 1, 1, 124: "nice", donice, 0, INF, 125: "nohup", donohup, 0, INF, 126: "notify", donotify, 0, INF, 127: "onintr", doonintr, 0, 2, 128: "popd", dopopd, 0, 1, 129: "pushd", dopushd, 0, 1, 130: #ifdef IIASA 131: "rd", dopopd, 0, 1, 132: #endif 133: "rehash", dohash, 0, 0, 134: "repeat", dorepeat, 2, INF, 135: "set", doset, 0, INF, 136: "setenv", dosetenv, 2, 2, 137: "shift", shift, 0, 1, 138: "source", dosource, 1, 1, 139: "stop", dostop, 1, INF, 140: "suspend", dosuspend, 0, 0, 141: "switch", doswitch, 1, INF, 142: "time", dotime, 0, INF, 143: "umask", doumask, 0, 1, 144: "unalias", unalias, 1, INF, 145: "unhash", dounhash, 0, 0, 146: #ifdef LIMIT 147: "unlimit", dounlimit, 0, INF, 148: #endif 149: "unset", unset, 1, INF, 150: "unsetenv", dounsetenv, 1, INF, 151: "wait", dowait, 0, 0, 152: "while", dowhile, 1, INF, 153: 0, 0, 0, 0, 154: }; 155: 156: #define ZBREAK 0 157: #define ZBRKSW 1 158: #define ZCASE 2 159: #define ZDEFAULT 3 160: #define ZELSE 4 161: #define ZEND 5 162: #define ZENDIF 6 163: #define ZENDSW 7 164: #define ZEXIT 8 165: #define ZFOREACH 9 166: #define ZGOTO 10 167: #define ZIF 11 168: #define ZLABEL 12 169: #define ZLET 13 170: #define ZSET 14 171: #define ZSWITCH 15 172: #define ZTEST 16 173: #define ZTHEN 17 174: #define ZWHILE 18 175: 176: struct srch { 177: char *s_name; 178: short s_value; 179: } srchn[] = { 180: "@", ZLET, 181: "break", ZBREAK, 182: "breaksw", ZBRKSW, 183: "case", ZCASE, 184: "default", ZDEFAULT, 185: "else", ZELSE, 186: "end", ZEND, 187: "endif", ZENDIF, 188: "endsw", ZENDSW, 189: "exit", ZEXIT, 190: "foreach", ZFOREACH, 191: "goto", ZGOTO, 192: "if", ZIF, 193: "label", ZLABEL, 194: "set", ZSET, 195: "switch", ZSWITCH, 196: "while", ZWHILE, 197: 0, 0, 198: }; 199: 200: struct mesg { 201: char *iname; 202: char *pname; 203: } mesg[] = { 204: 0, 0, 205: "HUP", "Hangup", 206: "INT", "Interrupt", 207: "QUIT", "Quit", 208: "ILL", "Illegal instruction", 209: "TRAP", "Trace/BPT trap", 210: "IOT", "IOT trap", 211: "EMT", "EMT trap", 212: "FPE", "Floating exception", 213: "KILL", "Killed", 214: "BUS", "Bus error", 215: "SEGV", "Segmentation fault", 216: "SYS", "Bad system call", 217: "PIPE", "Broken pipe", 218: "ALRM", "Alarm clock", 219: "TERM", "Terminated", 220: 0, "Signal 16", 221: "STOP", "Stopped (signal)", 222: "TSTP", "Stopped", 223: "CONT", "Continued", 224: "CHLD", "Child exited", 225: "TTIN", "Stopped (tty input)", 226: "TTOU", "Stopped (tty output)", 227: "TINT", "Tty input interrupt", 228: "XCPU", "Cputime limit exceeded", 229: "XFSZ", "Filesize limit exceeded", 230: 0, "Signal 26", 231: 0, "Signal 27", 232: 0, "Signal 28", 233: 0, "Signal 29", 234: 0, "Signal 30", 235: 0, "Signal 31", 236: 0, "Signal 32" 237: };