1: /* @(#)sh.init.c 2.1 SCCS id keyword */ 2: /* Copyright (c) 1980 Regents of the University of California */ 3: #include "sh.local.h" 4: /* 5: * C shell 6: */ 7: 8: extern int await(); 9: extern int chngd(); 10: extern int doalias(); 11: extern int dobreak(); 12: extern int docontin(); 13: extern int doecho(); 14: extern int doelse(); 15: extern int doend(); 16: extern int doendif(); 17: extern int doendsw(); 18: extern int doexit(); 19: extern int doforeach(); 20: extern int doglob(); 21: extern int dogoto(); 22: extern int dohash(); 23: extern int dohist(); 24: extern int doif(); 25: extern int dolet(); 26: extern int dologin(); 27: extern int dologout(); 28: extern int donewgrp(); 29: extern int donice(); 30: extern int donohup(); 31: extern int doonintr(); 32: extern int dorepeat(); 33: extern int doset(); 34: #ifndef V6 35: extern int dosetenv(); 36: #endif 37: extern int dosource(); 38: extern int doswbrk(); 39: extern int doswitch(); 40: extern int dotime(); 41: #ifndef V6 42: extern int doumask(); 43: #endif 44: extern int dowhile(); 45: extern int dozip(); 46: extern int execash(); 47: #ifdef VFORK 48: extern int hashstat(); 49: #endif 50: extern int goodbye(); 51: extern int shift(); 52: extern int showall(); 53: extern int unalias(); 54: extern int dounhash(); 55: extern int unset(); 56: 57: #define INF 1000 58: 59: struct biltins { 60: char *bname; 61: int (*bfunct)(); 62: short minargs, maxargs; 63: } bfunc[] = { 64: "@", dolet, 0, INF, 65: "alias", doalias, 0, INF, 66: #ifdef debug 67: "alloc", showall, 0, 1, 68: #endif 69: "break", dobreak, 0, 0, 70: "breaksw", doswbrk, 0, 0, 71: "case", dozip, 0, 1, 72: "cd", chngd, 0, 1, 73: "chdir", chngd, 0, 1, 74: "continue", docontin, 0, 0, 75: "default", dozip, 0, 0, 76: "echo", doecho, 0, INF, 77: "else", doelse, 0, INF, 78: "end", doend, 0, 0, 79: "endif", dozip, 0, 0, 80: "endsw", dozip, 0, 0, 81: "exec", execash, 1, INF, 82: "exit", doexit, 0, INF, 83: "foreach", doforeach, 3, INF, 84: "glob", doglob, 0, INF, 85: "goto", dogoto, 1, 1, 86: #ifdef VFORK 87: "hashstat", hashstat, 0, 0, 88: #endif 89: "history", dohist, 0, 0, 90: "if", doif, 1, INF, 91: "login", dologin, 0, 1, 92: "logout", dologout, 0, 0, 93: "newgrp", donewgrp, 1, 1, 94: "nice", donice, 0, INF, 95: "nohup", donohup, 0, INF, 96: "onintr", doonintr, 0, 2, 97: "rehash", dohash, 0, 0, 98: "repeat", dorepeat, 2, INF, 99: "set", doset, 0, INF, 100: #ifndef V6 101: "setenv", dosetenv, 2, 2, 102: #endif 103: "shift", shift, 0, 1, 104: "source", dosource, 1, 1, 105: "switch", doswitch, 1, INF, 106: "time", dotime, 0, INF, 107: #ifndef V6 108: "umask", doumask, 0, 1, 109: #endif 110: "unalias", unalias, 1, INF, 111: "unhash", dounhash, 0, 0, 112: "unset", unset, 1, INF, 113: "wait", await, 0, 0, 114: "while", dowhile, 1, INF, 115: 0, 0, 0, 0, 116: }; 117: 118: #define ZBREAK 0 119: #define ZBRKSW 1 120: #define ZCASE 2 121: #define ZDEFAULT 3 122: #define ZELSE 4 123: #define ZEND 5 124: #define ZENDIF 6 125: #define ZENDSW 7 126: #define ZEXIT 8 127: #define ZFOREACH 9 128: #define ZGOTO 10 129: #define ZIF 11 130: #define ZLABEL 12 131: #define ZLET 13 132: #define ZSET 14 133: #define ZSWITCH 15 134: #define ZTEST 16 135: #define ZTHEN 17 136: #define ZWHILE 18 137: 138: struct srch { 139: char *s_name; 140: short s_value; 141: } srchn[] = { 142: "@", ZLET, 143: "break", ZBREAK, 144: "breaksw", ZBRKSW, 145: "case", ZCASE, 146: "default", ZDEFAULT, 147: "else", ZELSE, 148: "end", ZEND, 149: "endif", ZENDIF, 150: "endsw", ZENDSW, 151: "exit", ZEXIT, 152: "foreach", ZFOREACH, 153: "goto", ZGOTO, 154: "if", ZIF, 155: "label", ZLABEL, 156: "set", ZSET, 157: "switch", ZSWITCH, 158: "while", ZWHILE, 159: 0, 0, 160: }; 161: 162: char *mesg[] = { 163: 0, 164: "Hangup", 165: 0, 166: "Quit", 167: "Illegal instruction", 168: "Trace/BPT trap", 169: "IOT trap", 170: "EMT trap", 171: "Floating exception", 172: "Killed", 173: "Bus error", 174: "Segmentation violation", 175: "Bad system call", 176: 0, 177: "Alarm clock", 178: "Terminated", 179: };