BSD 4 release
[unix-history] / usr / src / cmd / pi / yyoptions.c
CommitLineData
66d7e912
PK
1/* Copyright (c) 1979 Regents of the University of California */
2
31cef89c 3static char sccsid[] = "@(#)yyoptions.c 1.1 8/27/80";
66d7e912
PK
4
5#include "whoami.h"
6#include "0.h"
7#include "yy.h"
8
9/*
10 * Options processes the option
11 * strings which can appear in
12 * comments and returns the next character.
13 */
14options()
15{
16 register c, ch;
17 register char *optp;
18 int ok;
19
20 c = readch();
21 if (c != '$')
22 return (c);
23 do {
24 ch = c = readch();
25 switch (c) {
26 case 'b':
27 optp = &opt( 'b' );
28 c = readch();
29 if (!digit(c))
30 return (c);
31 *optp = c - '0';
32 c = readch();
33 break;
34# ifdef PC
35 case 'C':
36 /*
37 * C is a replacement for t, fake it.
38 */
39 c = 't';
40 /* and fall through */
41 case 'g':
42# endif PC
43 case 'k':
44 case 'l':
45 case 'n':
46 case 'p':
47 case 's':
48 case 't':
49 case 'u':
50 case 'w':
51 case 'z':
52 optp = &opt( c );
53 c = readch();
54 if (c == '+') {
55 *optp = 1;
56 c = readch();
57 } else if (c == '-') {
58 *optp = 0;
59 c = readch();
60 } else {
61 return (c);
62 }
63 break;
64 default:
65 return (c);
66 }
67#ifdef PI0
68 send(ROSET, ch, *optp);
69#endif
70 } while (c == ',');
71 if ( opt( 'u' ) )
72 setuflg();
73 return (c);
74}