Annotation of 3BSD/cmd/pi/yyoptions.c, revision 1.1

1.1     ! root        1: /* Copyright (c) 1979 Regents of the University of California */
        !             2: #
        !             3: /*
        !             4:  * pi - Pascal interpreter code translator
        !             5:  *
        !             6:  * Charles Haley, Bill Joy UCB
        !             7:  * Version 1.1 February 1978
        !             8:  */
        !             9: 
        !            10: #include "whoami"
        !            11: #include "0.h"
        !            12: #include "yy.h"
        !            13: 
        !            14: /*
        !            15:  * Options processes the option
        !            16:  * strings which can appear in
        !            17:  * comments and returns the next character.
        !            18:  */
        !            19: options()
        !            20: {
        !            21:        register c, ch;
        !            22:        register char *optp;
        !            23:        int ok;
        !            24: 
        !            25:        c = readch();
        !            26:        if (c != '$')
        !            27:                return (c);
        !            28:        do {
        !            29:                ch = c = readch();
        !            30:                switch (c) {
        !            31:                        case 'b':
        !            32:                                optp = &opts['b'-'a'];
        !            33:                                goto optdig;
        !            34:                        case 'x':
        !            35:                                optp = &opts['x'-'a'];
        !            36:                                goto optdig;
        !            37:                        optdig:
        !            38:                                c = readch();
        !            39:                                if (!digit(c))
        !            40:                                        return (c);
        !            41:                                *optp = c - '0';
        !            42:                                c = readch();
        !            43:                                break;
        !            44:                        default:
        !            45:                                if (c < 'a' || c > 'z')
        !            46:                                        return (c);
        !            47:                                optp = &opts[c-'a'];
        !            48:                                c = readch();
        !            49:                                if (c == '+') {
        !            50:                                        *optp = 1;
        !            51:                                        c = readch();
        !            52:                                } else if (c == '-') {
        !            53:                                        *optp = 0;
        !            54:                                        c = readch();
        !            55:                                } else
        !            56:                                        return (c);
        !            57:                                break;
        !            58:                        }
        !            59: #ifdef PI0
        !            60:                send(ROSET, ch, *optp);
        !            61: #endif
        !            62:        } while (c == ',');
        !            63:        if (opts['u'-'a'])
        !            64:                setuflg();
        !            65:        return (c);
        !            66: }

unix.superglobalmegacorp.com

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