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

Defined variables

bfunc defined in line 89; used 2 times
  • in line 166(2)
mesg defined in line 215; never used
nbfunc defined in line 166; never used
nsrchn defined in line 210; never used
sccsid defined in line 8; never used
srchn defined in line 191; used 2 times
  • in line 210(2)

Defined struct's

biltins defined in line 85; never used
mesg defined in line 212; never used
srch defined in line 188; never used

Defined macros

INF defined in line 83; used 27 times
ZBREAK defined in line 168; used 1 times
ZBRKSW defined in line 169; used 1 times
ZCASE defined in line 170; used 1 times
ZDEFAULT defined in line 171; used 1 times
ZELSE defined in line 172; used 1 times
ZEND defined in line 173; used 1 times
ZENDIF defined in line 174; used 1 times
ZENDSW defined in line 175; used 1 times
ZEXIT defined in line 176; used 1 times
ZFOREACH defined in line 177; used 1 times
ZGOTO defined in line 178; used 1 times
ZIF defined in line 179; used 1 times
ZLABEL defined in line 180; used 1 times
ZLET defined in line 181; used 1 times
ZSET defined in line 182; used 1 times
ZSWITCH defined in line 183; used 1 times
ZTEST defined in line 184; never used
ZTHEN defined in line 185; never used
ZWHILE defined in line 186; used 1 times
Last modified: 1996-09-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3537
Valid CSS Valid XHTML 1.0 Strict