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
error
defined in line
54; used 39 times
- in line 50,
149
- in /usr/src/bin/adb/access.c line
54,
76
- in /usr/src/bin/adb/command.c line
102,
122,
142,
186,
211
- in /usr/src/bin/adb/expr.c line
71,
101,
141,
152,
163,
209,
218-223(2),
307
- in /usr/src/bin/adb/format.c line
57,
63,
102,
217,
239,
263
- in /usr/src/bin/adb/input.c line
32
- in /usr/src/bin/adb/output.c line
296
- in /usr/src/bin/adb/pcs.c line
45,
63,
81,
89,
110-115(2)
- in /usr/src/bin/adb/print.c line
105,
123,
263-267(2),
309
- in /usr/src/bin/adb/runpcs.c line
99-104(2)
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
NOEOR
defined in line
3; used 1 times
eof
defined in line
29; used 2 times
infile
defined in line
8; used 3 times
lastc
defined in line
28; used 1 times
lp
defined in line
9; used 3 times
magic
defined in line
26; used 1 times
myname
defined in line
4; used 9 times
var
defined in line
31; used 7 times