|
|
1.1 root 1: #line 1 checkperms.lex
2: #include <stdio.h>
3: extern char yytext[];
4: extern int yyleng;
5: extern int yyscon;
6: extern int yyline;
7: #define input() getchar()
8: #define output(c) putchar(c)
9: #define unput(c) yyback(c)
10: #define ECHO {register n=0; while (n<yyleng) output(yytext[n++]);}
11: #define REJECT yyrjct()
12: #define BEGIN yyscon =
13: #line 2
14: #include "y.tab.h"
15: #include "checkperms.h"
16: #include "monitor.h"
17:
18: #undef input
19:
20: /*
21: * input routine takes care of tab counting.
22: */
23: input()
24: {
25: int c;
26: static int here = 0, atstart = 1, atpos = 0, level = 0, stops[20];
27:
28: while (atstart) {
29: switch (c = my_getchar()) {
30: case '\t':
31: atpos |= 7;
32: case ' ':
33: atpos++;
34: break;
35: case '\n':
36: atpos = 0;
37: lineno++;
38: #if 0
39: /* DEBUG */ fprintf(stderr, "lineno: %d\n", lineno);
40: #endif /* 0 */
41: break;
42: default:
43: my_ungetchar(c);
44: atstart = 0;
45: if (atpos > here) {
46: here = stops[++level] = atpos;
47: return(2);
48: }
49: } /* switch (c = my_getchar()) */
50:
51: }
52:
53: if (atpos < here) {
54: here = stops[--level];
55: return(1);
56: }
57:
58: switch (c = my_getchar()) {
59: case '\n':
60: atstart = 1;
61: atpos = 0;
62: lineno++;
63: #if 0
64: /* DEBUG */ fprintf(stderr, "lineno: %d\n", lineno);
65: #endif /* 0 */
66: }
67:
68: return(c);
69: }
70:
71: lookup(s)
72: char *s;
73: {
74: int i;
75: int retval;
76:
77: retval = 0;
78: for (i = 0; i < NUM_TOKENS; ++i){
79: if(strcmp(s, token_table[i].string) == 0) {
80: retval = token_table[i].value;
81: #ifdef DEBUG
82: fprintf(stderr,
83: "Token: %s, Line: %d\n",
84: token_table[i].string, lineno);
85: #endif DEBUG
86: } /* if s matches token_table[i].string */
87: } /* for i = 0 to NUM_TOKENS - walk through the table. */
88:
89: return(retval);
90: } /* lookup() */
91: #line 80
92:
93: #define yyswitch(x) yyctxt((x),(01))
94: _llic()
95: {
96: return (input());
97: }
98: _lloc(c)
99: {
100: output(c);
101: }
102: yylex()
103: {
104: #line 82
105: yyloop:
106: switch (_lltk()) {
107: case 0:
108: if (yywrap())
109: return (EOF);
110: break;
111: case 01:
112: #line 82
113: {
114: /* If we are at the bottom of a foreach */
115: if (host_looping && (current_path == NULL)) {
116: /* We probably want to rewind to the foreach. */
117: if (handle_foreach_unindent() == UNINDENT) {
118: /* No, we really are done with the
119: * foreach loop.
120: */
121: return(UNINDENT);
122: }
123: } else { /* Otherwise, just an ordinary unindent. */
124: return(UNINDENT);
125: } /* if we are at the bottom of a foreach */
126: } /* UNINDENT */
127: break;
128:
129: case 02:
130: #line 97
131: {
132: if (!ignore_next_indent) {
133: return(INDENT);
134: } else {
135: ignore_next_indent = FALSE;
136: } /* if !ignore_next_indent */
137: } /* INDENT */
138: break;
139: case 03:
140: #line 104
141: { /* Ignore everything after a "#" to end of line. */ }
142: break;
143: case 04:
144: #line 105
145: { /* Internal blanks and commas are white space. */ }
146: break;
147: case 05:
148: #line 106
149: { copy_str(&chmod_string, yytext);
150: return(CHMOD_PERMISSION);
151: } /* Chmod pattern. */
152: break;
153: case 06:
154: #line 109
155: { copy_str(&ret_string, yytext);
156: /* Strip off the leading and trailing quotes. */
157: ret_string[strlen(ret_string) - 1] = (char) NULL;
158: ++ret_string;
159: return(STRING);
160: } /* String pattern. */
161: break;
162: case 07:
163: #line 115
164: { int retval;
165: if ((retval = lookup(yytext)) == 0) {
166: fprintf(stderr,
167: "Invalid token %s ",
168: yytext);
169: FATAL("in line %d.\n", lineno);
170: } /* if retval invalid */
171: return(retval); }
172: break;
173: case 010:
174: #line 123
175: { return(NL); }
176: break;
177: }
178: goto yyloop;
179:
180: }
181: #line 125
182: int
183: handle_foreach_unindent()
184: {
185: #if 0
186: /* DEBUG */ printf("%d: finished a declarator block.\n", lineno);
187: #endif /* 0 */
188: if((current_host = next_host()) != NULL){
189: #if 0
190: /* DEBUG */ printf("%d: There is another host.\n", lineno);
191: #endif /* 0 */
192: saving_to_monitor_file = FALSE;
193: reading_from_monitor_file = TRUE;
194: rewind_monitor_file();
195: ignore_next_indent = TRUE;
196: } else {
197: #if 0
198: /* DEBUG */ printf("%d: No more hosts.\n", lineno);
199: #endif /* 0 */
200: close_monitor_file(); /* Throw away old input. */
201: saving_to_monitor_file = FALSE;
202: reading_from_monitor_file = FALSE;
203: host_looping = FALSE; /* We're done looping. */
204: return(UNINDENT);
205: }
206: return(0);
207: } /* handle_foreach_unindent() */
208: int yy_lxctab[] = {
209: 01000,00,010001,00,00,00,00,00,
210: 00,00,00,00,00,00,00,00,
211: 00,00,00,00,00,00,0100200,040,
212: 00,00,00,00,00,00,00,00,
213: 00,00,024000,00,00,00,00,00,
214: 00,00,00,00,00,00,00,00,
215: 00,00,00,00,00,00,00,0634,
216: 00,00,00,00,00,00,00,00,
217: 00,00,00,00,0177776,03777,0177776,03777,
218: 00,00,00,00,00,00,00,00,
219: 00,00,00,01777,0177776,03777,0177776,03777,
220: 00,00,00,00,00,00,00,00
221: };
222: int yy_lxbtab[] = {
223: 01<<000,01<<001,01<<002,01<<003,01<<004,01<<005,01<<006,01<<007,
224: 01<<010,01<<011,01<<012,01<<013,01<<014,01<<015,01<<016,01<<017
225: };
226: int yy_ctxtab[] = {
227: 00
228: };
229: int yy_lextab[] = {
230: 061,025,024,061,045,044,0161,01065,
231: 061,01351,0177761,0245,064,0101,06,0177761,
232: 0104,0161,026,0177761,046,066,0177761,0124,
233: 0261,01045,0161,0101,02705,01045,042,01351,
234: 0177661,01045,0144,0141,0106,061,0126,0177761,
235: 0164,061,0245,0204,00
236: };
237: int *yy_clist[050];
238: int *yy_nlist[050];
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.