BSD 4 release
[unix-history] / usr / src / cmd / pi / yyoptions.c
index ac75f4d..1145ed0 100644 (file)
@@ -1,13 +1,8 @@
 /* Copyright (c) 1979 Regents of the University of California */
 /* Copyright (c) 1979 Regents of the University of California */
-#
-/*
- * pi - Pascal interpreter code translator
- *
- * Charles Haley, Bill Joy UCB
- * Version 1.1 February 1978
- */
 
 
-#include "whoami"
+static char sccsid[] = "@(#)yyoptions.c 1.1 8/27/80";
+
+#include "whoami.h"
 #include "0.h"
 #include "yy.h"
 
 #include "0.h"
 #include "yy.h"
 
@@ -29,22 +24,32 @@ options()
                ch = c = readch();
                switch (c) {
                        case 'b':
                ch = c = readch();
                switch (c) {
                        case 'b':
-                               optp = &opts['b'-'a'];
-                               goto optdig;
-                       case 'x':
-                               optp = &opts['x'-'a'];
-                               goto optdig;
-                       optdig:
+                               optp = &opt( 'b' );
                                c = readch();
                                if (!digit(c))
                                        return (c);
                                *optp = c - '0';
                                c = readch();
                                break;
                                c = readch();
                                if (!digit(c))
                                        return (c);
                                *optp = c - '0';
                                c = readch();
                                break;
-                       default:
-                               if (c < 'a' || c > 'z')
-                                       return (c);
-                               optp = &opts[c-'a'];
+#                  ifdef PC
+                       case 'C':
+                                   /*
+                                    *  C is a replacement for t, fake it.
+                                    */
+                               c = 't';
+                               /* and fall through */
+                       case 'g':
+#                  endif PC
+                       case 'k':
+                       case 'l':
+                       case 'n':
+                       case 'p':
+                       case 's':
+                       case 't':
+                       case 'u':
+                       case 'w':
+                       case 'z':
+                               optp = &opt( c );
                                c = readch();
                                if (c == '+') {
                                        *optp = 1;
                                c = readch();
                                if (c == '+') {
                                        *optp = 1;
@@ -52,15 +57,18 @@ options()
                                } else if (c == '-') {
                                        *optp = 0;
                                        c = readch();
                                } else if (c == '-') {
                                        *optp = 0;
                                        c = readch();
-                               } else
+                               } else {
                                        return (c);
                                        return (c);
+                               }
                                break;
                                break;
+                       default:
+                                   return (c);
                        }
 #ifdef PI0
                send(ROSET, ch, *optp);
 #endif
        } while (c == ',');
                        }
 #ifdef PI0
                send(ROSET, ch, *optp);
 #endif
        } while (c == ',');
-       if (opts['u'-'a'])
+       if ( opt( 'u' ) )
                setuflg();
        return (c);
 }
                setuflg();
        return (c);
 }