1: #
   2: /*
   3:  *	UNIX shell
   4:  */
   5: 
   6: /* error exits from various parts of shell */
   7: #define ERROR   1
   8: #define SYNBAD  2
   9: #define SIGFAIL 3
  10: #define SIGFLG  0200
  11: 
  12: /* command tree */
  13: #define FPRS    020
  14: #define FINT    040
  15: #define FAMP    0100
  16: #define FPIN    0400
  17: #define FPOU    01000
  18: #define FPCL    02000
  19: #define FCMD    04000
  20: #define COMMSK  017
  21: 
  22: #define TCOM    0
  23: #define TPAR    1
  24: #define TFIL    2
  25: #define TLST    3
  26: #define TIF 4
  27: #define TWH 5
  28: #define TUN 6
  29: #define TSW 7
  30: #define TAND    8
  31: #define TORF    9
  32: #define TFORK   10
  33: #define TFOR    11
  34: 
  35: /* execute table */
  36: #define SYSSET  1
  37: #define SYSCD   2
  38: #define SYSEXEC 3
  39: #define SYSLOGIN 4
  40: #define SYSTRAP 5
  41: #define SYSEXIT 6
  42: #define SYSSHFT 7
  43: #define SYSWAIT 8
  44: #define SYSCONT 9
  45: #define SYSBREAK 10
  46: #define SYSEVAL 11
  47: #define SYSDOT  12
  48: #define SYSRDONLY 13
  49: #define SYSTIMES 14
  50: #define SYSXPORT 15
  51: #define SYSNULL 16
  52: #define SYSREAD 17
  53: #define SYSTST  18
  54: #define SYSUMASK    19
  55: 
  56: /* used for input and output of shell */
  57: #define INIO 10
  58: #define OTIO 11
  59: 
  60: /*io nodes*/
  61: #define USERIO  10
  62: #define IOUFD   15
  63: #define IODOC   16
  64: #define IOPUT   32
  65: #define IOAPP   64
  66: #define IOMOV   128
  67: #define IORDW   256
  68: #define INPIPE  0
  69: #define OTPIPE  1
  70: 
  71: /* arg list terminator */
  72: #define ENDARGS 0
  73: 
  74: #include    "mac.h"
  75: #include    "mode.h"
  76: #include    "name.h"
  77: 
  78: 
  79: /* result type declarations */
  80: #define alloc malloc
  81: ADDRESS     alloc();
  82: VOID        addblok();
  83: STRING      make();
  84: STRING      movstr();
  85: TREPTR      cmd();
  86: TREPTR      makefork();
  87: NAMPTR      lookup();
  88: VOID        setname();
  89: VOID        setargs();
  90: DOLPTR      useargs();
  91: REAL        expr();
  92: STRING      catpath();
  93: STRING      getpath();
  94: STRING      *scan();
  95: STRING      mactrim();
  96: STRING      macro();
  97: STRING      execs();
  98: VOID        await();
  99: VOID        post();
 100: STRING      copyto();
 101: VOID        exname();
 102: STRING      staknam();
 103: VOID        printnam();
 104: VOID        printflg();
 105: VOID        prs();
 106: VOID        prc();
 107: VOID        getenv();
 108: STRING      *setenv();
 109: 
 110: #define attrib(n,f) (n->namflg |= f)
 111: #define round(a,b)  (((int)((ADR(a)+b)-1))&~((b)-1))
 112: #define closepipe(x)    (close(x[INPIPE]), close(x[OTPIPE]))
 113: #define eq(a,b)     (cf(a,b)==0)
 114: #define max(a,b)    ((a)>(b)?(a):(b))
 115: #define assert(x)   ;
 116: 
 117: /* temp files and io */
 118: UFD     output;
 119: INT     ioset;
 120: IOPTR       iotemp;     /* files to be deleted sometime */
 121: IOPTR       iopend;     /* documents waiting to be read at NL */
 122: 
 123: /* substitution */
 124: INT     dolc;
 125: STRING      *dolv;
 126: DOLPTR      argfor;
 127: ARGPTR      gchain;
 128: 
 129: /* stack */
 130: #define     BLK(x)  ((BLKPTR)(x))
 131: #define     BYT(x)  ((BYTPTR)(x))
 132: #define     STK(x)  ((STKPTR)(x))
 133: #define     ADR(x)  ((char*)(x))
 134: 
 135: /* stak stuff */
 136: #include    "stak.h"
 137: 
 138: /* string constants */
 139: MSG     atline;
 140: MSG     readmsg;
 141: MSG     colon;
 142: MSG     minus;
 143: MSG     nullstr;
 144: MSG     sptbnl;
 145: MSG     unexpected;
 146: MSG     endoffile;
 147: MSG     synmsg;
 148: 
 149: /* name tree and words */
 150: SYSTAB      reserved;
 151: INT     wdval;
 152: INT     wdnum;
 153: ARGPTR      wdarg;
 154: INT     wdset;
 155: BOOL        reserv;
 156: 
 157: /* prompting */
 158: MSG     stdprompt;
 159: MSG     supprompt;
 160: MSG     profile;
 161: 
 162: /* built in names */
 163: NAMNOD      fngnod;
 164: NAMNOD      ifsnod;
 165: NAMNOD      homenod;
 166: NAMNOD      mailnod;
 167: NAMNOD      pathnod;
 168: NAMNOD      ps1nod;
 169: NAMNOD      ps2nod;
 170: 
 171: /* special names */
 172: MSG     flagadr;
 173: STRING      cmdadr;
 174: STRING      exitadr;
 175: STRING      dolladr;
 176: STRING      pcsadr;
 177: STRING      pidadr;
 178: 
 179: MSG     defpath;
 180: 
 181: /* names always present */
 182: MSG     mailname;
 183: MSG     homename;
 184: MSG     pathname;
 185: MSG     fngname;
 186: MSG     ifsname;
 187: MSG     ps1name;
 188: MSG     ps2name;
 189: 
 190: /* transput */
 191: CHAR        tmpout[];
 192: STRING      tmpnam;
 193: INT     serial;
 194: #define     TMPNAM 7
 195: FILE        standin;
 196: #define input   (standin->fdes)
 197: #define eof (standin->feof)
 198: INT     peekc;
 199: STRING      comdiv;
 200: MSG     devnull;
 201: 
 202: /* flags */
 203: #define     noexec  01
 204: #define     intflg  02
 205: #define     prompt  04
 206: #define     setflg  010
 207: #define     errflg  020
 208: #define     ttyflg  040
 209: #define     forked  0100
 210: #define     oneflg  0200
 211: #define     rshflg  0400
 212: #define     waiting 01000
 213: #define     stdflg  02000
 214: #define     execpr  04000
 215: #define     readpr  010000
 216: #define     keyflg  020000
 217: INT     flags;
 218: 
 219: /* error exits from various parts of shell */
 220: #include    <setjmp.h>
 221: jmp_buf     subshell;
 222: jmp_buf     errshell;
 223: 
 224: /* fault handling */
 225: #include    "brkincr.h"
 226: POS     brkincr;
 227: 
 228: #define MINTRAP 0
 229: #define MAXTRAP 17
 230: 
 231: #define INTR    2
 232: #define QUIT    3
 233: #define MEMF    11
 234: #define ALARM   14
 235: #define KILL    15
 236: #define TRAPSET 2
 237: #define SIGSET  4
 238: #define SIGMOD  8
 239: 
 240: VOID        fault();
 241: BOOL        trapnote;
 242: STRING      trapcom[];
 243: BOOL        trapflg[];
 244: 
 245: /* name tree and words */
 246: STRING      *environ;
 247: CHAR        numbuf[];
 248: MSG     export;
 249: MSG     readonly;
 250: 
 251: /* execflgs */
 252: INT     exitval;
 253: BOOL        execbrk;
 254: INT     loopcnt;
 255: INT     breakcnt;
 256: 
 257: /* messages */
 258: MSG     mailmsg;
 259: MSG     coredump;
 260: MSG     badopt;
 261: MSG     badparam;
 262: MSG     badsub;
 263: MSG     nospace;
 264: MSG     notfound;
 265: MSG     badtrap;
 266: MSG     baddir;
 267: MSG     badshift;
 268: MSG     illegal;
 269: MSG     restricted;
 270: MSG     execpmsg;
 271: MSG     notid;
 272: MSG     wtfailed;
 273: MSG     badcreate;
 274: MSG     piperr;
 275: MSG     badopen;
 276: MSG     badnum;
 277: MSG     arglist;
 278: MSG     txtbsy;
 279: MSG     toobig;
 280: MSG     badexec;
 281: MSG     notfound;
 282: MSG     badfile;
 283: 
 284: address end[];
 285: 
 286: #include    "ctype.h"

Defined variables

errshell defined in line 222; used 2 times
subshell defined in line 221; used 2 times

Defined macros

ADR defined in line 133; used 11 times
ALARM defined in line 234; used 2 times
BLK defined in line 130; used 9 times
BYT defined in line 131; never used
COMMSK defined in line 20; used 1 times
ENDARGS defined in line 72; used 7 times
ERROR defined in line 7; used 1 times
FAMP defined in line 15; used 4 times
FCMD defined in line 19; never used
FINT defined in line 14; used 3 times
FPCL defined in line 18; used 2 times
FPIN defined in line 16; used 2 times
FPOU defined in line 17; used 5 times
FPRS defined in line 13; used 2 times
INIO defined in line 57; used 2 times
INPIPE defined in line 68; used 5 times
INTR defined in line 231; used 2 times
IOAPP defined in line 65; used 2 times
IODOC defined in line 63; used 4 times
IOMOV defined in line 66; used 2 times
IOPUT defined in line 64; used 2 times
IORDW defined in line 67; used 1 times
IOUFD defined in line 62; used 2 times
KILL defined in line 235; used 1 times
MAXTRAP defined in line 229; used 6 times
MEMF defined in line 233; used 2 times
MINTRAP defined in line 228; used 1 times
OTIO defined in line 58; used 2 times
OTPIPE defined in line 69; used 5 times
QUIT defined in line 232; used 2 times
SIGFAIL defined in line 9; used 1 times
SIGFLG defined in line 10; used 1 times
SIGMOD defined in line 238; used 4 times
STK defined in line 132; used 1 times
SYNBAD defined in line 8; used 1 times
SYSBREAK defined in line 45; used 1 times
SYSCD defined in line 37; used 2 times
SYSCONT defined in line 44; used 1 times
SYSDOT defined in line 47; used 1 times
SYSEVAL defined in line 46; used 1 times
SYSEXEC defined in line 38; used 1 times
SYSEXIT defined in line 41; used 1 times
SYSLOGIN defined in line 39; used 2 times
SYSNULL defined in line 51; used 1 times
SYSRDONLY defined in line 48; used 1 times
SYSREAD defined in line 52; used 1 times
SYSSET defined in line 36; used 1 times
SYSSHFT defined in line 42; used 1 times
SYSTIMES defined in line 49; used 1 times
SYSTRAP defined in line 40; used 1 times
SYSTST defined in line 53; never used
SYSUMASK defined in line 54; used 1 times
SYSWAIT defined in line 43; used 1 times
SYSXPORT defined in line 50; used 1 times
TAND defined in line 30; used 1 times
TCOM defined in line 22; used 2 times
TFIL defined in line 24; used 1 times
TFOR defined in line 33; used 1 times
TFORK defined in line 32; used 1 times
TIF defined in line 26; used 1 times
TLST defined in line 25; used 1 times
TMPNAM defined in line 194; used 1 times
TORF defined in line 31; used 1 times
TPAR defined in line 23; used 1 times
TRAPSET defined in line 236; used 4 times
TSW defined in line 29; used 1 times
TUN defined in line 28; used 1 times
TWH defined in line 27; used 2 times
USERIO defined in line 61; used 1 times
alloc defined in line 80; used 4 times
assert defined in line 115; used 1 times
attrib defined in line 110; used 2 times
closepipe defined in line 112; used 2 times
eof defined in line 197; used 5 times
eq defined in line 113; used 4 times
errflg defined in line 207; used 3 times
execpr defined in line 214; used 5 times
forked defined in line 209; used 3 times
input defined in line 196; used 13 times
intflg defined in line 204; used 2 times
keyflg defined in line 216; used 2 times
max defined in line 114; used 1 times
noexec defined in line 203; used 4 times
oneflg defined in line 210; used 4 times
prompt defined in line 205; used 6 times
readpr defined in line 215; used 3 times
round defined in line 111; used 4 times
rshflg defined in line 211; used 5 times
setflg defined in line 206; used 2 times
stdflg defined in line 213; used 4 times
ttyflg defined in line 208; used 8 times
waiting defined in line 212; used 3 times

Usage of this include

Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1776
Valid CSS Valid XHTML 1.0 Strict