1: #include "defs.h" 2: 3: int mkfault; 4: char line[LINSIZ]; 5: int infile; 6: char *lp; 7: char lastc = EOR; 8: int eof; 9: 10: /* input routines */ 11: 12: eol(c) 13: char c; 14: { 15: return(c==EOR || c==';'); 16: } 17: 18: rdc() 19: { REP readchar(); 20: PER lastc==SP ORF lastc==TB 21: DONE 22: return(lastc); 23: } 24: 25: readchar() 26: { 27: IF eof 28: THEN lastc = '\0'; 29: ELSE IF lp==0 30: THEN lp=line; 31: REP eof = read(infile,lp,1)==0; 32: IF mkfault THEN error((char *)0); FI 33: PER eof==0 ANDF *lp++!=EOR DONE 34: *lp=0; lp=line; 35: FI 36: IF lastc = *lp THEN lp++; FI 37: FI 38: return(lastc); 39: } 40: 41: nextchar() 42: { 43: IF eol(rdc()) 44: THEN lp--; return(0); 45: ELSE return(lastc); 46: FI 47: } 48: 49: quotchar() 50: { 51: IF readchar()=='\\' 52: THEN return(readchar()); 53: ELIF lastc=='\'' 54: THEN return(0); 55: ELSE return(lastc); 56: FI 57: } 58: 59: getformat(deformat) 60: char *deformat; 61: { 62: register char *fptr; 63: register int quote; 64: 65: fptr=deformat; quote=FALSE; 66: WHILE (quote ? readchar()!=EOR : !eol(readchar())) 67: DO IF (*fptr++ = lastc)=='"' 68: THEN quote = ~quote; 69: FI 70: OD 71: lp--; 72: IF fptr!=deformat THEN *fptr++ = '\0'; FI 73: }