Commit | Line | Data |
---|---|---|
9319b3c3 C |
1 | diff -rc ../gawk-2.11.orig/Makefile ./Makefile |
2 | *** ../gawk-2.11.orig/Makefile Mon Nov 13 13:51:42 1989 | |
3 | --- ./Makefile Fri Aug 17 15:50:18 1990 | |
4 | *************** | |
5 | *** 103,114 **** | |
6 | # need to customize this file below this point. | |
7 | # | |
8 | ||
9 | ! FLAGS= $(MISSING) $(DEBUG) | |
10 | CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) $(OPTIMIZE) $(WARN) | |
11 | ||
12 | # object files | |
13 | AWKOBJS = main.o eval.o builtin.o msg.o debug.o io.o field.o array.o node.o \ | |
14 | ! version.o missing.o | |
15 | ||
16 | ALLOBJS = $(AWKOBJS) awk.tab.o | |
17 | ||
18 | --- 103,117 ---- | |
19 | # need to customize this file below this point. | |
20 | # | |
21 | ||
22 | ! FLAGS= $(MISSING) $(DEBUG) -DSNMP | |
23 | CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) $(OPTIMIZE) $(WARN) | |
24 | + SNMP-C = snmp.c | |
25 | + SNMP-O = snmp.o | |
26 | + SNMP-LIB= -lisnmp -lisode | |
27 | ||
28 | # object files | |
29 | AWKOBJS = main.o eval.o builtin.o msg.o debug.o io.o field.o array.o node.o \ | |
30 | ! version.o missing.o $(SNMP-O) | |
31 | ||
32 | ALLOBJS = $(AWKOBJS) awk.tab.o | |
33 | ||
34 | *************** | |
35 | *** 118,124 **** | |
36 | ||
37 | # source and documentation files | |
38 | SRC = main.c eval.c builtin.c msg.c \ | |
39 | ! debug.c io.c field.c array.c node.c missing.c | |
40 | ||
41 | ALLSRC= $(SRC) awk.tab.c | |
42 | ||
43 | --- 121,127 ---- | |
44 | ||
45 | # source and documentation files | |
46 | SRC = main.c eval.c builtin.c msg.c \ | |
47 | ! debug.c io.c field.c array.c node.c missing.c $(SNMP-C) | |
48 | ||
49 | ALLSRC= $(SRC) awk.tab.c | |
50 | ||
51 | *************** | |
52 | *** 154,160 **** | |
53 | ||
54 | # rules to build gawk | |
55 | gawk: $(ALLOBJS) $(GNUOBJS) | |
56 | ! $(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) -lm | |
57 | ||
58 | $(AWKOBJS): awk.h | |
59 | ||
60 | --- 157,163 ---- | |
61 | ||
62 | # rules to build gawk | |
63 | gawk: $(ALLOBJS) $(GNUOBJS) | |
64 | ! $(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) $(SNMP-LIB) -lm | |
65 | ||
66 | $(AWKOBJS): awk.h | |
67 | ||
68 | diff -rc ../gawk-2.11.orig/array.c ./array.c | |
69 | *** ../gawk-2.11.orig/array.c Mon Nov 13 13:51:44 1989 | |
70 | --- ./array.c Fri Aug 17 15:21:52 1990 | |
71 | *************** | |
72 | *** 35,41 **** | |
73 | --- 35,46 ---- | |
74 | #define MAKE_POS(v) (v & ~0x80000000) /* make number positive */ | |
75 | ||
76 | NODE * | |
77 | + #ifndef SNMP | |
78 | concat_exp(tree) | |
79 | + #else | |
80 | + concat_exp(tree,isnmp) | |
81 | + int isnmp; | |
82 | + #endif | |
83 | NODE *tree; | |
84 | { | |
85 | NODE *r; | |
86 | *************** | |
87 | *** 51,58 **** | |
88 | --- 56,73 ---- | |
89 | r = force_string(tree_eval(tree->lnode)); | |
90 | if (tree->rnode == NULL) | |
91 | return r; | |
92 | + #ifdef SNMP | |
93 | + if (isnmp) { | |
94 | + subseplen = Ndot_string -> stlen; | |
95 | + subsep = Ndot_string -> stptr; | |
96 | + } | |
97 | + else { | |
98 | + #endif | |
99 | subseplen = SUBSEP_node->lnode->stlen; | |
100 | subsep = SUBSEP_node->lnode->stptr; | |
101 | + #ifdef SNMP | |
102 | + } | |
103 | + #endif | |
104 | len = r->stlen + subseplen + 1; | |
105 | emalloc(str, char *, len, "concat_exp"); | |
106 | memcpy(str, r->stptr, r->stlen+1); | |
107 | *************** | |
108 | *** 89,94 **** | |
109 | --- 104,113 ---- | |
110 | int i; | |
111 | NODE *bucket, *next; | |
112 | ||
113 | + #ifdef SNMP | |
114 | + if (symbol -> magic) | |
115 | + fatal ("split into SNMP array variable not allowed"); | |
116 | + #endif | |
117 | if (symbol->var_array == 0) | |
118 | return; | |
119 | for (i = 0; i < ASSOC_HASHSIZE; i++) { | |
120 | *************** | |
121 | *** 132,137 **** | |
122 | --- 151,161 ---- | |
123 | { | |
124 | register NODE *bucket; | |
125 | ||
126 | + #ifdef SNMP | |
127 | + if (symbol -> magic) | |
128 | + fatal ("assoc_find: internal error"); | |
129 | + #endif | |
130 | + | |
131 | for (bucket = symbol->var_array[hash1]; bucket; bucket = bucket->ahnext) { | |
132 | if (cmp_nodes(bucket->ahname, subs)) | |
133 | continue; | |
134 | *************** | |
135 | *** 151,159 **** | |
136 | --- 175,192 ---- | |
137 | ||
138 | if (symbol->type == Node_param_list) | |
139 | symbol = stack_ptr[symbol->param_cnt]; | |
140 | + #ifdef SNMP | |
141 | + if (symbol -> magic) | |
142 | + return *assoc_lookup (symbol, concat_exp (subs, 1)) | |
143 | + != Nnull_string; | |
144 | + #endif | |
145 | if (symbol->var_array == 0) | |
146 | return 0; | |
147 | + #ifndef SNMP | |
148 | subs = concat_exp(subs); | |
149 | + #else | |
150 | + subs = concat_exp(subs,0); | |
151 | + #endif | |
152 | hash1 = hash_calc(subs); | |
153 | if (assoc_find(symbol, subs, hash1) == NULL) { | |
154 | free_temp(subs); | |
155 | *************** | |
156 | *** 180,185 **** | |
157 | --- 213,224 ---- | |
158 | ||
159 | hash1 = hash_calc(subs); | |
160 | ||
161 | + #ifdef SNMP | |
162 | + if (symbol -> magic) { | |
163 | + snmp_get (symbol, force_string (subs) -> stptr); | |
164 | + return &symbol -> var_value; | |
165 | + } | |
166 | + #endif | |
167 | if (symbol->var_array == 0) { /* this table really should grow | |
168 | * dynamically */ | |
169 | emalloc(symbol->var_array, NODE **, (sizeof(NODE *) * | |
170 | *************** | |
171 | *** 210,218 **** | |
172 | --- 249,265 ---- | |
173 | register NODE *bucket, *last; | |
174 | NODE *subs; | |
175 | ||
176 | + #ifdef SNMP | |
177 | + if (symbol -> magic) | |
178 | + fatal ("delete into SNMP array variable not allowed"); | |
179 | + #endif | |
180 | if (symbol->var_array == 0) | |
181 | return; | |
182 | + #ifndef SNMP | |
183 | subs = concat_exp(tree); | |
184 | + #else | |
185 | + subs = concat_exp(tree,0); | |
186 | + #endif | |
187 | hash1 = hash_calc(subs); | |
188 | ||
189 | last = NULL; | |
190 | *************** | |
191 | *** 234,244 **** | |
192 | --- 281,300 ---- | |
193 | } | |
194 | ||
195 | struct search * | |
196 | + #ifndef SNMP | |
197 | assoc_scan(symbol) | |
198 | + #else | |
199 | + assoc_scan(symbol,instance) | |
200 | + NODE *instance; | |
201 | + #endif | |
202 | NODE *symbol; | |
203 | { | |
204 | struct search *lookat; | |
205 | ||
206 | + #ifdef SNMP | |
207 | + if (symbol -> magic) | |
208 | + return snmp_assoc_scan (symbol,instance); | |
209 | + #endif | |
210 | if (!symbol->var_array) | |
211 | return 0; | |
212 | emalloc(lookat, struct search *, sizeof(struct search), "assoc_scan"); | |
213 | *************** | |
214 | *** 245,257 **** | |
215 | --- 301,326 ---- | |
216 | lookat->numleft = ASSOC_HASHSIZE; | |
217 | lookat->arr_ptr = symbol->var_array; | |
218 | lookat->bucket = symbol->var_array[0]; | |
219 | + #ifndef SNMP | |
220 | return assoc_next(lookat); | |
221 | + #else | |
222 | + return assoc_next(symbol, lookat); | |
223 | + #endif | |
224 | } | |
225 | ||
226 | struct search * | |
227 | + #ifndef SNMP | |
228 | assoc_next(lookat) | |
229 | + #else | |
230 | + assoc_next(symbol, lookat) | |
231 | + NODE *symbol; | |
232 | + #endif | |
233 | struct search *lookat; | |
234 | { | |
235 | + #ifdef SNMP | |
236 | + if (symbol -> magic) | |
237 | + return snmp_assoc_next (lookat, 0); | |
238 | + #endif | |
239 | for (; lookat->numleft; lookat->numleft--) { | |
240 | while (lookat->bucket != 0) { | |
241 | lookat->retval = lookat->bucket->ahname; | |
242 | diff -rc ../gawk-2.11.orig/awk.h ./awk.h | |
243 | *** ../gawk-2.11.orig/awk.h Mon Nov 13 13:51:46 1989 | |
244 | --- ./awk.h Fri Aug 17 15:21:53 1990 | |
245 | *************** | |
246 | *** 62,68 **** | |
247 | #endif | |
248 | ||
249 | #ifdef __STDC__ | |
250 | ! extern void *malloc(unsigned), *realloc(void *, unsigned); | |
251 | extern void free(char *); | |
252 | extern char *getenv(char *); | |
253 | ||
254 | --- 62,68 ---- | |
255 | #endif | |
256 | ||
257 | #ifdef __STDC__ | |
258 | ! extern char *malloc(unsigned), *realloc(void *, unsigned); | |
259 | extern void free(char *); | |
260 | extern char *getenv(char *); | |
261 | ||
262 | *************** | |
263 | *** 224,229 **** | |
264 | --- 224,235 ---- | |
265 | Node_K_while, /* lnode is condtional, rnode is stuff to run */ | |
266 | Node_K_for, /* lnode is for_struct, rnode is stuff to run */ | |
267 | Node_K_arrayfor, /* lnode is for_struct, rnode is stuff to run */ | |
268 | + #ifdef SNMP | |
269 | + /* init: target | |
270 | + cond: instance (optional) | |
271 | + incr: array | |
272 | + */ | |
273 | + #endif | |
274 | Node_K_break, /* no subs */ | |
275 | Node_K_continue, /* no stuff */ | |
276 | Node_K_print, /* lnode is exp_list, rnode is redirect */ | |
277 | *************** | |
278 | *** 245,250 **** | |
279 | --- 251,259 ---- | |
280 | ||
281 | /* Variables */ | |
282 | Node_var, /* rnode is value, lnode is array stuff */ | |
283 | + #ifdef SNMP | |
284 | + /* magic is pointer to (OT) */ | |
285 | + #endif | |
286 | Node_var_array, /* array is ptr to elements, asize num of | |
287 | * eles */ | |
288 | Node_val, /* node is a value - type in flags */ | |
289 | *************** | |
290 | *** 298,303 **** | |
291 | --- 307,315 ---- | |
292 | char *name; | |
293 | short number; | |
294 | unsigned char recase; | |
295 | + #ifdef SNMP | |
296 | + caddr_t cookie; | |
297 | + #endif | |
298 | } nodep; | |
299 | struct { | |
300 | AWKNUM fltnum; /* this is here for optimal packing of | |
301 | *************** | |
302 | *** 341,346 **** | |
303 | --- 353,361 ---- | |
304 | #define lnode sub.nodep.l.lptr | |
305 | #define nextp sub.nodep.l.nextnode | |
306 | #define rnode sub.nodep.r.rptr | |
307 | + #ifdef SNMP | |
308 | + #define magic sub.nodep.cookie | |
309 | + #endif | |
310 | #define source_file sub.nodep.name | |
311 | #define source_line sub.nodep.number | |
312 | #define param_cnt sub.nodep.number | |
313 | *************** | |
314 | *** 533,539 **** | |
315 | --- 548,558 ---- | |
316 | extern NODE **get_lhs(NODE *, int); | |
317 | extern void do_deref(void ); | |
318 | extern struct search *assoc_scan(NODE *); | |
319 | + #ifndef SNMP | |
320 | extern struct search *assoc_next(struct search *); | |
321 | + #else SNMP | |
322 | + extern struct search *assoc_next(NODE *symbol, struct search *lookat); | |
323 | + #endif SNMP | |
324 | extern NODE **assoc_lookup(NODE *, NODE *); | |
325 | extern double r_force_number(NODE *); | |
326 | extern NODE *r_force_string(NODE *); | |
327 | *************** | |
328 | *** 608,610 **** | |
329 | --- 627,658 ---- | |
330 | #endif | |
331 | ||
332 | extern char casetable[]; /* for case-independent regexp matching */ | |
333 | + | |
334 | + | |
335 | + #ifdef SNMP | |
336 | + extern NODE *AGENT_node, | |
337 | + *COMMUNITY_node, | |
338 | + *DIAGNOSTIC_node, | |
339 | + *ERROR_node, | |
340 | + *RETRIES_node, | |
341 | + *TIMEOUT_node; | |
342 | + | |
343 | + extern NODE *Ndot_string; | |
344 | + | |
345 | + extern int snmp_enabled; | |
346 | + extern char *snmp_file; | |
347 | + | |
348 | + | |
349 | + #ifdef __STDC__ | |
350 | + int check_snmp(NODE *r, char *name); | |
351 | + int snmp_get(NODE *ptr, char *instname); | |
352 | + char *snmp_name(NODE *ptr); | |
353 | + struct search *snmp_assoc_scan(NODE *symbol); | |
354 | + struct search *snmp_assoc_next(struct search *lookat, int done); | |
355 | + #else | |
356 | + int check_snmp (); | |
357 | + int snmp_get (); | |
358 | + char *snmp_name (); | |
359 | + struct search *snmp_assoc_scan (), *snmp_assoc_next (); | |
360 | + #endif | |
361 | + #endif | |
362 | diff -rc ../gawk-2.11.orig/builtin.c ./builtin.c | |
363 | *** ../gawk-2.11.orig/builtin.c Mon Nov 13 13:51:49 1989 | |
364 | --- ./builtin.c Fri Aug 17 15:14:58 1990 | |
365 | *************** | |
366 | *** 533,538 **** | |
367 | --- 533,606 ---- | |
368 | fflush(fp); | |
369 | } | |
370 | ||
371 | + #ifdef SNMP | |
372 | + NODE *do_band (tree) | |
373 | + NODE *tree; | |
374 | + { | |
375 | + #ifdef sun386 | |
376 | + long l; | |
377 | + #endif | |
378 | + unsigned long d1, | |
379 | + d2; | |
380 | + NODE *s1, | |
381 | + *s2; | |
382 | + | |
383 | + get_two (tree, &s1, &s2); | |
384 | + | |
385 | + #ifdef sun386 | |
386 | + l = force_number (s1); | |
387 | + d1 = (unsigned long) l; | |
388 | + #else | |
389 | + d1 = (unsigned long) force_number (s1); | |
390 | + #endif | |
391 | + | |
392 | + #ifdef sun386 | |
393 | + l = force_number (s2); | |
394 | + d2 = (unsigned long) l; | |
395 | + #else | |
396 | + d2 = (unsigned long) force_number (s2); | |
397 | + #endif | |
398 | + | |
399 | + free_temp (s1); | |
400 | + free_temp (s2); | |
401 | + | |
402 | + return tmp_number ((AWKNUM) ((unsigned long) (d1 & d2))); | |
403 | + } | |
404 | + | |
405 | + NODE *do_bor (tree) | |
406 | + NODE *tree; | |
407 | + { | |
408 | + #ifdef sun386 | |
409 | + long l; | |
410 | + #endif | |
411 | + unsigned long d1, | |
412 | + d2; | |
413 | + NODE *s1, | |
414 | + *s2; | |
415 | + | |
416 | + get_two (tree, &s1, &s2); | |
417 | + | |
418 | + #ifdef sun386 | |
419 | + l = force_number (s1); | |
420 | + d1 = (unsigned long) l; | |
421 | + #else | |
422 | + d1 = (unsigned long) force_number (s1); | |
423 | + #endif | |
424 | + | |
425 | + #ifdef sun386 | |
426 | + l = force_number (s2); | |
427 | + d2 = (unsigned long) l; | |
428 | + #else | |
429 | + d2 = (unsigned long) force_number (s2); | |
430 | + #endif | |
431 | + | |
432 | + free_temp (s1); | |
433 | + free_temp (s2); | |
434 | + | |
435 | + return tmp_number ((AWKNUM) ((unsigned long) (d1 | d2))); | |
436 | + } | |
437 | + #endif | |
438 | + | |
439 | NODE * | |
440 | do_sqrt(tree) | |
441 | NODE *tree; | |
442 | diff -rc ../gawk-2.11.orig/debug.c ./debug.c | |
443 | *** ../gawk-2.11.orig/debug.c Mon Nov 13 13:51:51 1989 | |
444 | --- ./debug.c Fri Aug 17 15:14:59 1990 | |
445 | *************** | |
446 | *** 107,114 **** | |
447 | --- 107,122 ---- | |
448 | { | |
449 | struct search *l; | |
450 | ||
451 | + #ifndef SNMP | |
452 | printf("(0x%x Array)\n", ptr); | |
453 | for (l = assoc_scan(ptr); l; l = assoc_next(l)) { | |
454 | + #else | |
455 | + printf("(0x%x Array%s)\n", ptr, | |
456 | + ptr -> magic ? " {SNMP}": ""); | |
457 | + if (ptr -> magic) | |
458 | + return; | |
459 | + for (l = assoc_scan(ptr); l; l = assoc_next(ptr, l)) { | |
460 | + #endif | |
461 | printf("\tindex: "); | |
462 | print_parse_tree(l->retval); | |
463 | printf("\tvalue: "); | |
464 | *************** | |
465 | *** 344,349 **** | |
466 | --- 352,361 ---- | |
467 | for (buc = variables[n]; buc; buc = buc->hnext) { | |
468 | if (buc->hvalue == ptr) { | |
469 | printf("%.*s", buc->hlength, buc->hname); | |
470 | + #ifdef SNMP | |
471 | + if (ptr -> magic) | |
472 | + printf ("{SNMP}"); | |
473 | + #endif | |
474 | n = HASHSIZE; | |
475 | break; | |
476 | } | |
477 | diff -rc ../gawk-2.11.orig/eval.c ./eval.c | |
478 | *** ../gawk-2.11.orig/eval.c Mon Nov 13 13:51:53 1989 | |
479 | --- ./eval.c Fri Aug 17 15:21:52 1990 | |
480 | *************** | |
481 | *** 302,308 **** | |
482 | --- 302,314 ---- | |
483 | if (t->type == Node_param_list) | |
484 | t = stack_ptr[t->param_cnt]; | |
485 | stable_tree = tree; | |
486 | + #ifndef SNMP | |
487 | for (l = assoc_scan(t); l; l = assoc_next((struct search *)l)) { | |
488 | + #else | |
489 | + for (l = assoc_scan (t, tree -> forloop -> cond); | |
490 | + l; | |
491 | + l = assoc_next (t, l)) { | |
492 | + #endif | |
493 | deref = *((NODE **) lhs); | |
494 | do_deref(); | |
495 | *lhs = dupnode(l->retval); | |
496 | *************** | |
497 | *** 318,323 **** | |
498 | --- 324,333 ---- | |
499 | break; | |
500 | ||
501 | case TAG_BREAK: | |
502 | + #ifdef SNMP | |
503 | + if (t -> magic) | |
504 | + (void) snmp_assoc_next (l, 1); | |
505 | + #endif | |
506 | RESTORE_BINDING(loop_tag_stack, loop_tag, loop_tag_valid); | |
507 | field_num = -1; | |
508 | return 1; | |
509 | *************** | |
510 | *** 916,922 **** | |
511 | --- 926,936 ---- | |
512 | */ | |
513 | if (arg->type == Node_param_list) | |
514 | arg = stack_ptr[arg->param_cnt]; | |
515 | + #ifndef SNMP | |
516 | if (arg->type == Node_var_array) | |
517 | + #else | |
518 | + if (arg -> type == Node_var_array && !arg -> magic) | |
519 | + #endif | |
520 | *r = *arg; | |
521 | else { | |
522 | n = tree_eval(arg); | |
523 | *************** | |
524 | *** 984,989 **** | |
525 | --- 998,1008 ---- | |
526 | arg = argp->lnode; | |
527 | n = *sp++; | |
528 | if (arg->type == Node_var && n->type == Node_var_array) { | |
529 | + #ifdef SNMP | |
530 | + if (arg -> magic) | |
531 | + fatal ("array assignment to SNMP scalar variable \"%s\"", | |
532 | + snmp_name (arg)); | |
533 | + #endif | |
534 | arg->var_array = n->var_array; | |
535 | arg->type = Node_var_array; | |
536 | } | |
537 | *************** | |
538 | *** 1035,1040 **** | |
539 | --- 1054,1068 ---- | |
540 | switch (ptr->type) { | |
541 | case Node_var: | |
542 | case Node_var_array: | |
543 | + #ifdef SNMP | |
544 | + if (ptr -> magic) | |
545 | + if (assign) | |
546 | + fatal ("attempt to set SNMP %s variable \"%s\"", | |
547 | + ptr -> type == Node_var ? "scalar" : "array", | |
548 | + snmp_name (ptr)); | |
549 | + else | |
550 | + snmp_get (ptr, (char *) NULL); | |
551 | + #endif | |
552 | if (ptr == NF_node && (int) NF_node->var_value->numbr == -1) | |
553 | (void) get_field(HUGE-1, assign); /* parse record */ | |
554 | deref = ptr->var_value; | |
555 | *************** | |
556 | *** 1071,1077 **** | |
557 | --- 1099,1113 ---- | |
558 | n = ptr->lnode; | |
559 | if (n->type == Node_param_list) | |
560 | n = stack_ptr[n->param_cnt]; | |
561 | + #ifdef SNMP | |
562 | + if (n -> magic && assign) | |
563 | + fatal ("attempt to set SNMP array variable \"%s\"", | |
564 | + snmp_name (n)); | |
565 | + aptr = assoc_lookup(n, | |
566 | + concat_exp(ptr->rnode, n -> magic ? 1 : 0)); | |
567 | + #else | |
568 | aptr = assoc_lookup(n, concat_exp(ptr->rnode)); | |
569 | + #endif | |
570 | deref = *aptr; | |
571 | #ifdef DEBUG | |
572 | if (deref->type != Node_val) | |
573 | diff -rc ../gawk-2.11.orig/node.c ./node.c | |
574 | *** ../gawk-2.11.orig/node.c Mon Nov 13 13:52:13 1989 | |
575 | --- ./node.c Fri Aug 17 15:15:01 1990 | |
576 | *************** | |
577 | *** 277,282 **** | |
578 | --- 277,285 ---- | |
579 | #endif | |
580 | it->type = ty; | |
581 | it->flags = MALLOC; | |
582 | + #ifdef SNMP | |
583 | + it->magic = NULL; | |
584 | + #endif | |
585 | #ifdef MEMDEBUG | |
586 | fprintf(stderr, "node: new: %0x\n", it); | |
587 | #endif | |
588 | *** ../gawk-2.11.orig/awk.y Mon Nov 13 13:51:48 1989 | |
589 | --- awk.y Fri Aug 17 16:57:20 1990 | |
590 | *************** | |
591 | *** 325,330 **** | |
592 | --- 325,335 ---- | |
593 | { $$ = node ($3, Node_K_while, $6); } | |
594 | | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls | |
595 | { $$ = node ($6, Node_K_do, $3); } | |
596 | + | LEX_FOR '(' NAME LEX_IN NAME comma exp r_paren opt_nls statement | |
597 | + { | |
598 | + $$ = node ($10, Node_K_arrayfor, make_for_loop(variable($3), | |
599 | + $7, variable($5))); | |
600 | + } | |
601 | | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement | |
602 | { | |
603 | $$ = node ($8, Node_K_arrayfor, make_for_loop(variable($3), | |
604 | *************** | |
605 | *** 684,689 **** | |
606 | --- 689,697 ---- | |
607 | *do_split(), *do_system(), *do_int(), *do_close(), | |
608 | *do_atan2(), *do_sin(), *do_cos(), *do_rand(), | |
609 | *do_srand(), *do_match(), *do_tolower(), *do_toupper(), | |
610 | + #ifdef SNMP | |
611 | + *do_band (), *do_bor (), | |
612 | + #endif | |
613 | *do_sub(), *do_gsub(); | |
614 | ||
615 | /* Special functions for debugging */ | |
616 | *************** | |
617 | *** 697,702 **** | |
618 | --- 705,714 ---- | |
619 | { "BEGIN", Node_illegal, LEX_BEGIN, 0, 0 }, | |
620 | { "END", Node_illegal, LEX_END, 0, 0 }, | |
621 | { "atan2", Node_builtin, LEX_BUILTIN, 0, do_atan2 }, | |
622 | + #ifdef SNMP | |
623 | + { "bit_and", Node_builtin, LEX_BUILTIN, 0, do_band }, | |
624 | + { "bit_or", Node_builtin, LEX_BUILTIN, 0, do_bor }, | |
625 | + #endif | |
626 | #ifdef DEBUG | |
627 | { "bp", Node_builtin, LEX_BUILTIN, 0, do_bp }, | |
628 | #endif | |
629 | *************** | |
630 | *** 1680,1686 **** | |
631 | --- 1692,1706 ---- | |
632 | register NODE *r; | |
633 | ||
634 | if ((r = lookup(variables, name)) == NULL) | |
635 | + #ifdef SNMP | |
636 | + { | |
637 | + #endif | |
638 | r = install(variables, name, | |
639 | node(Nnull_string, Node_var, (NODE *) NULL)); | |
640 | + #ifdef SNMP | |
641 | + if (snmp_enabled && r) | |
642 | + snmp_check (r, name); | |
643 | + } | |
644 | + #endif | |
645 | return r; | |
646 | } | |
647 | *** ../gawk-2.11.orig/main.c Mon Nov 13 13:52:08 1989 | |
648 | --- main.c Fri Aug 17 17:00:30 1990 | |
649 | *************** | |
650 | *** 94,101 **** | |
651 | --- 94,106 ---- | |
652 | */ | |
653 | #define EXTENSIONS 8 /* where to clear */ | |
654 | #ifdef DEBUG | |
655 | + #ifndef SNMP | |
656 | char awk_opts[] = "F:f:v:caeCVdD"; | |
657 | #else | |
658 | + char awk_opts[] = "F:f:v:caeCVdDsS"; | |
659 | + extern int debug; | |
660 | + #endif | |
661 | + #else | |
662 | char awk_opts[] = "F:f:v:caeCV"; | |
663 | #endif | |
664 | ||
665 | *************** | |
666 | *** 192,198 **** | |
667 | --- 197,213 ---- | |
668 | debugging++; | |
669 | yydebug = 2; | |
670 | break; | |
671 | + | |
672 | + #ifdef SNMP | |
673 | + case 's': | |
674 | + debug = 1; | |
675 | + break; | |
676 | + | |
677 | + case 'S': | |
678 | + debug = 2; | |
679 | + break; | |
680 | #endif | |
681 | + #endif | |
682 | ||
683 | #ifndef STRICT | |
684 | case 'c': | |
685 | *************** | |
686 | *** 483,488 **** | |
687 | --- 498,512 ---- | |
688 | RSTART_node = spc_var("RSTART", make_number(0.0)); | |
689 | SUBSEP_node = spc_var("SUBSEP", make_string("\034", 1)); | |
690 | IGNORECASE_node = spc_var("IGNORECASE", make_number(0.0)); | |
691 | + #ifdef SNMP | |
692 | + if (snmp_init ()) | |
693 | + AGENT_node = spc_var ("AGENT", make_string ("localhost", 9)); | |
694 | + COMMUNITY_node = spc_var ("COMMUNITY", make_string ("public", 6)); | |
695 | + DIAGNOSTIC_node = spc_var ("DIAGNOSTIC", Nnull_string); | |
696 | + ERROR_node = spc_var ("ERROR", make_number (0.0)); | |
697 | + RETRIES_node = spc_var ("RETRIES", make_number (3.0)); | |
698 | + TIMEOUT_node = spc_var ("TIMEOUT", make_number (10.0)); | |
699 | + #endif | |
700 | ||
701 | ENVIRON_node = spc_var("ENVIRON", Nnull_string); | |
702 | for (i = 0; environ[i]; i++) { |