Annotation of researchv8dc/cmd/adb/input.c, revision 1.1

1.1     ! root        1: #
        !             2: /*
        !             3:  *
        !             4:  *     UNIX debugger
        !             5:  *
        !             6:  */
        !             7: 
        !             8: #include "defs.h"
        !             9: 
        !            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 || c==';');
        !            22: }
        !            23: 
        !            24: int
        !            25: rdc()
        !            26: {
        !            27:        do {
        !            28:                readchar();
        !            29:        } while (lastc==SP || lastc==TB);
        !            30:        return(lastc);
        !            31: }
        !            32: 
        !            33: reread()
        !            34: {
        !            35:        peekc = lastc;
        !            36: }
        !            37: 
        !            38: clrinp()
        !            39: {
        !            40: 
        !            41:        lp = 0;
        !            42:        peekc = 0;
        !            43: }
        !            44: 
        !            45: int
        !            46: readchar()
        !            47: {
        !            48:        if (eof)
        !            49:                lastc=0;
        !            50:        else if (peekc) {
        !            51:                lastc = peekc;
        !            52:                peekc = 0;
        !            53:        }
        !            54:        else {
        !            55:                if (lp==0) {
        !            56:                        lp=line;
        !            57:                        do {
        !            58:                                eof = read(infile,lp,1)==0;
        !            59:                                if (mkfault)
        !            60:                                        error(0);
        !            61:                        } while (eof==0 && *lp++!=EOR);
        !            62:                        *lp=0;
        !            63:                        lp=line;
        !            64:                }
        !            65:                if ((lastc = *lp) != 0)
        !            66:                        lp++;
        !            67:        }
        !            68:        return(lastc);
        !            69: }
        !            70: 
        !            71: nextchar()
        !            72: {
        !            73:        if (eol(rdc())) {
        !            74:                reread();
        !            75:                return(0);
        !            76:        }
        !            77:        return(lastc);
        !            78: }
        !            79: 
        !            80: quotchar()
        !            81: {
        !            82:        if (readchar()=='\\')
        !            83:                return(readchar());
        !            84:        else if (lastc=='\'')
        !            85:                return(0);
        !            86:        else
        !            87:                return(lastc);
        !            88: }
        !            89: 
        !            90: getformat(deformat)
        !            91: char *deformat;
        !            92: {
        !            93:        register char *fptr;
        !            94:        register BOOL   quote;
        !            95: 
        !            96:        fptr=deformat;
        !            97:        quote=FALSE;
        !            98:        while ((quote ? readchar()!=EOR : !eol(readchar())))
        !            99:                if ((*fptr++ = lastc)=='"')
        !           100:                        quote = ~quote;
        !           101:        lp--;
        !           102:        if (fptr!=deformat)
        !           103:                *fptr = '\0';
        !           104: }

unix.superglobalmegacorp.com

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