Commit | Line | Data |
---|---|---|
0fc6e47b KB |
1 | /*- |
2 | * Copyright (c) 1980 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
252367af | 6 | */ |
66d7e912 | 7 | |
72fbef68 | 8 | #ifndef lint |
0fc6e47b KB |
9 | static char sccsid[] = "@(#)yyoptions.c 5.2 (Berkeley) %G%"; |
10 | #endif /* not lint */ | |
66d7e912 PK |
11 | |
12 | #include "whoami.h" | |
13 | #include "0.h" | |
72fbef68 | 14 | #include "tree_ty.h" /* must be included for yy.h */ |
66d7e912 PK |
15 | #include "yy.h" |
16 | ||
17 | /* | |
18 | * Options processes the option | |
19 | * strings which can appear in | |
20 | * comments and returns the next character. | |
21 | */ | |
22 | options() | |
23 | { | |
72fbef68 RT |
24 | register c; |
25 | #ifdef PI0 | |
26 | register ch; | |
27 | #endif | |
66d7e912 | 28 | register char *optp; |
66d7e912 PK |
29 | |
30 | c = readch(); | |
31 | if (c != '$') | |
32 | return (c); | |
33 | do { | |
72fbef68 RT |
34 | c = readch(); |
35 | # ifdef PI0 | |
36 | ch = c; | |
37 | # endif | |
66d7e912 PK |
38 | switch (c) { |
39 | case 'b': | |
40 | optp = &opt( 'b' ); | |
41 | c = readch(); | |
42 | if (!digit(c)) | |
43 | return (c); | |
44 | *optp = c - '0'; | |
45 | c = readch(); | |
46 | break; | |
47 | # ifdef PC | |
48 | case 'C': | |
49 | /* | |
50 | * C is a replacement for t, fake it. | |
51 | */ | |
52 | c = 't'; | |
53 | /* and fall through */ | |
54 | case 'g': | |
55 | # endif PC | |
56 | case 'k': | |
57 | case 'l': | |
58 | case 'n': | |
59 | case 'p': | |
60 | case 's': | |
61 | case 't': | |
62 | case 'u': | |
63 | case 'w': | |
64 | case 'z': | |
65 | optp = &opt( c ); | |
66 | c = readch(); | |
67 | if (c == '+') { | |
68 | *optp = 1; | |
69 | c = readch(); | |
70 | } else if (c == '-') { | |
71 | *optp = 0; | |
72 | c = readch(); | |
73 | } else { | |
74 | return (c); | |
75 | } | |
76 | break; | |
77 | default: | |
78 | return (c); | |
79 | } | |
80 | #ifdef PI0 | |
81 | send(ROSET, ch, *optp); | |
82 | #endif | |
83 | } while (c == ','); | |
84 | if ( opt( 'u' ) ) | |
85 | setuflg(); | |
86 | return (c); | |
87 | } |