# 2.11BSD#431 - /usr/src/bin/sh/error.c

##### Functions

    done              X
    error             X
    exitset           X
    exitsh            X
    failed            X
    rmtemp            X
    sigchk            X

       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

- in line 63
- in /usr/src/bin/sh/fault.c line 35
- in /usr/src/bin/sh/main.c line 97
- in /usr/src/bin/sh/xec.c line 143, 301, 307

error defined in line 45; used 9 times

- in /usr/src/bin/sh/fault.c line 31
- in /usr/src/bin/sh/io.c line 66
- in /usr/src/bin/sh/macro.c line 30, 50, 98-103(2), 133
- in /usr/src/bin/sh/xec.c line 155, 231

exitset defined in line 19; used 4 times

- in /usr/src/bin/sh/fault.c line 114
- in /usr/src/bin/sh/main.c line 148
- in /usr/src/bin/sh/service.c line 284
- in /usr/src/bin/sh/xec.c line 403

exitsh defined in line 51; used 5 times

- in line 31, 42
- in /usr/src/bin/sh/cmd.c line 409
- in /usr/src/bin/sh/service.c line 282
- in /usr/src/bin/sh/xec.c line 91

failed defined in line 35; used 21 times

- in line 48
- in /usr/src/bin/sh/args.c line 52
- in /usr/src/bin/sh/io.c line 76, 97
- in /usr/src/bin/sh/macro.c line 129, 137
- in /usr/src/bin/sh/name.c line 100, 124, 197
- in /usr/src/bin/sh/print.c line 97
- in /usr/src/bin/sh/service.c line 54, 60, 79, 128, 169-175(3)
- in /usr/src/bin/sh/xec.c line 77, 115, 147-149(2)

rmtemp defined in line 80; used 2 times

- in line 76
- in /usr/src/bin/sh/stak.c line 71

sigchk defined in line 24; used 7 times

- in /usr/src/bin/sh/name.c line 256
- in /usr/src/bin/sh/service.c line 141, 384
- in /usr/src/bin/sh/word.c line 133
- in /usr/src/bin/sh/xec.c line 34, 244, 406

#### 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: 750 |