1: #ifndef lint
   2: static char sccsid[] = "@(#)error.c	4.2 8/11/83";
   3: #endif
   4: 
   5: #
   6: /*
   7:  * UNIX shell
   8:  *
   9:  * S. R. Bourne
  10:  * Bell Telephone Laboratories
  11:  *
  12:  */
  13: 
  14: #include    "defs.h"
  15: 
  16: 
  17: /* ========	error handling	======== */
  18: 
  19: exitset()
  20: {
  21:     assnum(&exitadr,exitval);
  22: }
  23: 
  24: sigchk()
  25: {
  26:     /* Find out if it is time to go away.
  27: 	 * `trapnote' is set to SIGSET when fault is seen and
  28: 	 * no trap has been set.
  29: 	 */
  30:     IF trapnote&SIGSET
  31:     THEN    exitsh(SIGFAIL);
  32:     FI
  33: }
  34: 
  35: failed(s1,s2)
  36:     STRING  s1, s2;
  37: {
  38:     prp(); prs(s1);
  39:     IF s2
  40:     THEN    prs(colon); prs(s2);
  41:     FI
  42:     newline(); exitsh(ERROR);
  43: }
  44: 
  45: error(s)
  46:     STRING  s;
  47: {
  48:     failed(s,NIL);
  49: }
  50: 
  51: exitsh(xno)
  52:     INT xno;
  53: {
  54:     /* Arrive here from `FATAL' errors
  55: 	 *  a) exit command,
  56: 	 *  b) default trap,
  57: 	 *  c) fault with no trap set.
  58: 	 *
  59: 	 * Action is to return to command level or exit.
  60: 	 */
  61:     exitval=xno;
  62:     IF (flags & (forked|errflg|ttyflg)) != ttyflg
  63:     THEN    done();
  64:     ELSE    clearup();
  65:         longjmp(errshell,1);
  66:     FI
  67: }
  68: 
  69: done()
  70: {
  71:     REG STRING  t;
  72:     IF t=trapcom[0]
  73:     THEN    trapcom[0]=0; /*should free but not long */
  74:         execexp(t,0);
  75:     FI
  76:     rmtemp(0);
  77:     exit(exitval);
  78: }
  79: 
  80: rmtemp(base)
  81:     IOPTR       base;
  82: {
  83:     WHILE iotemp>base
  84:     DO  unlink(iotemp->ioname);
  85:         iotemp=iotemp->iolst;
  86:     OD
  87: }

Defined functions

done defined in line 69; used 6 times
error defined in line 45; used 9 times
exitsh defined in line 51; used 5 times
rmtemp defined in line 80; used 2 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1983-08-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2464
Valid CSS Valid XHTML 1.0 Strict