|
|
1.1 root 1: /*
2: *
3: * UNIX debugger
4: *
5: */
6:
7: #include "defs.h"
8:
9: INT mkfault;
10: CHAR line[LINSIZ];
11: INT infile;
12: CHAR *lp;
13: CHAR peekc,lastc = EOR;
14: INT eof;
15:
16: /* input routines */
17:
18: eol(c)
19: CHAR c;
20: {
21: return(c==EOR ORF c==';');
22: }
23:
24: rdc()
25: { REP readchar();
26: PER lastc==SP ORF lastc==TB
27: DONE
28: return(lastc);
29: }
30:
31: readchar(dmy)
32: {
33: IF eof
34: THEN lastc=0;
35: ELSE IF lp==0
36: THEN lp=line;
37: REP eof = read(infile,lp,1)==0;
38: IF mkfault THEN error(0); FI
39: PER eof==0 ANDF *lp++!=EOR DONE
40: *lp=0; lp=line;
41: FI
42: IF lastc = peekc THEN peekc=0;
43: ELIF lastc = *lp THEN lp++;
44: FI
45: FI
46: return(lastc);
47: }
48:
49: nextchar()
50: {
51: IF eol(rdc())
52: THEN lp--; return(0);
53: ELSE return(lastc);
54: FI
55: }
56:
57: quotchar()
58: {
59: IF readchar()=='\\'
60: THEN return(readchar());
61: ELIF lastc=='\''
62: THEN return(0);
63: ELSE return(lastc);
64: FI
65: }
66:
67: getformat(deformat)
68: STRING deformat;
69: {
70: REG STRING fptr;
71: REG BOOL quote;
72: fptr=deformat; quote=FALSE;
73: WHILE (quote ? readchar()!=EOR : !eol(readchar()))
74: DO IF (*fptr++ = lastc)=='"'
75: THEN quote = ~quote;
76: FI
77: OD
78: lp--;
79: IF fptr!=deformat THEN *fptr++ = '\0'; FI
80: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.