1: #include "defs.h"
   2: 
   3:     MSG NOEOR;
   4:     char    *myname;    /* program name */
   5:     int argcount;
   6:     int mkfault;
   7:     int executing;
   8:     int infile;
   9:     char    *lp;
  10:     int maxoff;
  11:     int maxpos;
  12:     int (*sigint)();
  13:     int (*sigqit)();
  14:     int wtflag;
  15:     int kernel;
  16:     long    maxfile;
  17:     long    maxstor;
  18:     long    txtsiz;
  19:     long    datsiz;
  20:     long    datbas;
  21:     long    stksiz;
  22:     long    ovlsiz;
  23:     int overlay;
  24:     char    *errflg;
  25:     int exitflg;
  26:     int magic;
  27:     long    entrypt;
  28:     char    lastc;
  29:     int eof;
  30:     int lastcom;
  31:     long    var[36];
  32:     char    *symfil;
  33:     char    *corfil;
  34:     char    *printptr;
  35:     char    *Ipath = "/usr/share/adb";
  36: 
  37: long    round(a,b)
  38: long        a, b;
  39: {
  40:     long        w;
  41:     w = ((a+b-1)/b)*b;
  42:     return(w);
  43: }
  44: 
  45: /* error handling */
  46: 
  47: chkerr()
  48: {
  49:     IF errflg ORF mkfault
  50:     THEN    error(errflg);
  51:     FI
  52: }
  53: 
  54: error(n)
  55:     char    *n;
  56: {
  57:     errflg=n;
  58:     iclose(0, 1); oclose();
  59:     longjmp(erradb,1);
  60: }
  61: 
  62: fault(a)
  63: {
  64:     signal(a,fault);
  65:     lseek(infile,0L,2);
  66:     mkfault++;
  67: }
  68: 
  69: /* set up files and initial address mappings */
  70: 
  71: main(argc, argv)
  72:     register char   **argv;
  73:     int argc;
  74: {
  75:     short   mynamelen;      /* length of program name */
  76: 
  77:     maxfile = 1L << 24;
  78:     maxstor = 1L << 16;
  79:     if  (isatty(0))
  80:         myname = *argv;
  81:     else
  82:         myname = "adb";
  83:     mynamelen = strlen(myname);
  84: 
  85:     gtty(0,&adbtty);
  86:     gtty(0,&usrtty);
  87:     WHILE argc>1
  88:     DO  IF !strcmp("-w",argv[1])
  89:         THEN    wtflag=2; argc--; argv++; continue;
  90:         ELIF !strcmp("-k",argv[1])
  91:         THEN    kernel++; argc--; argv++; continue;
  92:         ELIF !strcmp("-I",argv[1])
  93:         THEN    Ipath = argv[2]; argc -= 2; argv += 2; continue;
  94:         ELSE    break;
  95:         FI
  96:     OD
  97: 
  98:     IF argc>1 THEN symfil = argv[1]; FI
  99:     IF argc>2 THEN corfil = argv[2]; FI
 100:     argcount=argc;
 101:     setsym(); setcor();
 102: 
 103:     /* set up variables for user */
 104:     maxoff=MAXOFF; maxpos=MAXPOS;
 105:     var[VARB] = datbas;
 106:     var[VARD] = datsiz;
 107:     var[VARE] = entrypt;
 108:     var[VARM] = magic;
 109:     var[VARS] = stksiz;
 110:     var[VART] = txtsiz;
 111:     /* if text overlay, enter total overlay area size */
 112:     IF overlay
 113:     THEN    var[VARO] = ovlsiz;
 114:     FI
 115: 
 116:     IF (sigint=signal(SIGINT,SIG_IGN))!=SIG_IGN
 117:     THEN    sigint=fault; signal(SIGINT,fault);
 118:     FI
 119:     sigqit=signal(SIGQUIT,SIG_IGN);
 120:     siginterrupt(SIGINT, 1);
 121:     siginterrupt(SIGQUIT, 1);
 122:     setjmp(erradb);
 123:     IF executing THEN delbp(); FI
 124:     executing=FALSE;
 125: 
 126:     LOOP    flushbuf();
 127:         IF errflg
 128:         THEN printf("%s\n",errflg);
 129:              exitflg=(int)errflg;
 130:              errflg=0;
 131:         FI
 132:         IF mkfault
 133:         THEN    mkfault=0; printc(EOR);
 134:             printf("%s\n", myname);
 135:         FI
 136:         IF myname ANDF !infile
 137:         THEN    write(1,myname,mynamelen);
 138:             write(1,"> ",2);
 139:         FI
 140:         lp=0; rdc(); lp--;
 141:         IF eof
 142:         THEN    IF infile
 143:             THEN    iclose(-1, 0); eof=0; longjmp(erradb,1);
 144:             ELSE    done();
 145:             FI
 146:         ELSE    exitflg=0;
 147:         FI
 148:         command(0,lastcom);
 149:         IF lp ANDF lastc!=EOR THEN error(NOEOR); FI
 150:     POOL
 151: }
 152: 
 153: done()
 154: {
 155:     endpcs();
 156:     exit(exitflg);
 157: }

Defined functions

done defined in line 153; used 2 times
fault defined in line 62; used 3 times
main defined in line 71; never used
round defined in line 37; used 9 times

Defined variables

Ipath defined in line 35; used 1 times
  • in line 93
NOEOR defined in line 3; used 1 times
argcount defined in line 5; used 1 times
corfil defined in line 33; used 1 times
  • in line 99
datbas defined in line 20; used 1 times
datsiz defined in line 19; used 1 times
entrypt defined in line 27; used 1 times
eof defined in line 29; used 2 times
errflg defined in line 24; used 7 times
executing defined in line 7; used 2 times
exitflg defined in line 25; used 3 times
infile defined in line 8; used 3 times
kernel defined in line 15; used 1 times
  • in line 91
lastc defined in line 28; used 1 times
lastcom defined in line 30; used 1 times
lp defined in line 9; used 3 times
magic defined in line 26; used 1 times
maxfile defined in line 16; used 1 times
  • in line 77
maxoff defined in line 10; used 1 times
maxpos defined in line 11; used 1 times
maxstor defined in line 17; used 1 times
  • in line 78
mkfault defined in line 6; used 4 times
myname defined in line 4; used 9 times
overlay defined in line 23; used 1 times
ovlsiz defined in line 22; used 1 times
printptr defined in line 34; never used
stksiz defined in line 21; used 1 times
symfil defined in line 32; used 1 times
  • in line 98
txtsiz defined in line 18; used 1 times
var defined in line 31; used 7 times
wtflag defined in line 14; used 1 times
  • in line 89
Last modified: 1996-10-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 4297
Valid CSS Valid XHTML 1.0 Strict