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

Defined variables

bfunc defined in line 84; used 2 times
  • in line 156(2)
mesg defined in line 205; never used
nbfunc defined in line 156; never used
nsrchn defined in line 200; never used
sccsid defined in line 8; never used
srchn defined in line 181; used 2 times
  • in line 200(2)

Defined struct's

biltins defined in line 80; never used
mesg defined in line 202; never used
srch defined in line 178; never used

Defined macros

INF defined in line 78; used 26 times
ZBREAK defined in line 158; used 1 times
ZBRKSW defined in line 159; used 1 times
ZCASE defined in line 160; used 1 times
ZDEFAULT defined in line 161; used 1 times
ZELSE defined in line 162; used 1 times
ZEND defined in line 163; used 1 times
ZENDIF defined in line 164; used 1 times
ZENDSW defined in line 165; used 1 times
ZEXIT defined in line 166; used 1 times
ZFOREACH defined in line 167; used 1 times
ZGOTO defined in line 168; used 1 times
ZIF defined in line 169; used 1 times
ZLABEL defined in line 170; used 1 times
ZLET defined in line 171; used 1 times
ZSET defined in line 172; used 1 times
ZSWITCH defined in line 173; used 1 times
ZTEST defined in line 174; never used
ZTHEN defined in line 175; never used
ZWHILE defined in line 176; used 1 times
Last modified: 1985-06-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1444
Valid CSS Valid XHTML 1.0 Strict