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