Annotation of 43BSD/bin/adb/input.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.