gawk-patches
来自「ftam等标准协议服务器和客户端的源代码。」· 代码 · 共 799 行 · 第 1/2 页
TXT
799 行
diff -rc gawk-2.11.orig/Makefile Makefile*** gawk-2.11.orig/Makefile Mon Nov 13 13:51:42 1989--- Makefile Fri Aug 17 15:50:18 1990****************** 103,114 **** # need to customize this file below this point. # ! FLAGS= $(MISSING) $(DEBUG) CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) $(OPTIMIZE) $(WARN) # object files AWKOBJS = main.o eval.o builtin.o msg.o debug.o io.o field.o array.o node.o \! version.o missing.o ALLOBJS = $(AWKOBJS) awk.tab.o --- 103,117 ---- # need to customize this file below this point. # ! FLAGS= $(MISSING) $(DEBUG) -DSNMP CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) $(OPTIMIZE) $(WARN)+ SNMP-C = snmp.c+ SNMP-O = snmp.o+ SNMP-LIB= -lisnmp -lisode # object files AWKOBJS = main.o eval.o builtin.o msg.o debug.o io.o field.o array.o node.o \! version.o missing.o $(SNMP-O) ALLOBJS = $(AWKOBJS) awk.tab.o ****************** 118,124 **** # source and documentation files SRC = main.c eval.c builtin.c msg.c \! debug.c io.c field.c array.c node.c missing.c ALLSRC= $(SRC) awk.tab.c --- 121,127 ---- # source and documentation files SRC = main.c eval.c builtin.c msg.c \! debug.c io.c field.c array.c node.c missing.c $(SNMP-C) ALLSRC= $(SRC) awk.tab.c ****************** 154,160 **** # rules to build gawk gawk: $(ALLOBJS) $(GNUOBJS)! $(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) -lm $(AWKOBJS): awk.h --- 157,163 ---- # rules to build gawk gawk: $(ALLOBJS) $(GNUOBJS)! $(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) $(SNMP-LIB) -lm $(AWKOBJS): awk.h diff -rc gawk-2.11.orig/array.c array.c*** gawk-2.11.orig/array.c Mon Nov 13 13:51:44 1989--- array.c Fri Aug 17 15:21:52 1990****************** 35,41 ****--- 35,46 ---- #define MAKE_POS(v) (v & ~0x80000000) /* make number positive */ NODE *+ #ifndef SNMP concat_exp(tree)+ #else+ concat_exp(tree,isnmp)+ int isnmp;+ #endif NODE *tree; { NODE *r;****************** 51,58 ****--- 56,73 ---- r = force_string(tree_eval(tree->lnode)); if (tree->rnode == NULL) return r;+ #ifdef SNMP+ if (isnmp) {+ subseplen = Ndot_string -> stlen;+ subsep = Ndot_string -> stptr;+ }+ else {+ #endif subseplen = SUBSEP_node->lnode->stlen; subsep = SUBSEP_node->lnode->stptr;+ #ifdef SNMP+ }+ #endif len = r->stlen + subseplen + 1; emalloc(str, char *, len, "concat_exp"); memcpy(str, r->stptr, r->stlen+1);****************** 89,94 ****--- 104,113 ---- int i; NODE *bucket, *next; + #ifdef SNMP+ if (symbol -> magic)+ fatal ("split into SNMP array variable not allowed");+ #endif if (symbol->var_array == 0) return; for (i = 0; i < ASSOC_HASHSIZE; i++) {****************** 132,137 ****--- 151,161 ---- { register NODE *bucket; + #ifdef SNMP+ if (symbol -> magic)+ fatal ("assoc_find: internal error");+ #endif+ for (bucket = symbol->var_array[hash1]; bucket; bucket = bucket->ahnext) { if (cmp_nodes(bucket->ahname, subs)) continue;****************** 151,159 ****--- 175,192 ---- if (symbol->type == Node_param_list) symbol = stack_ptr[symbol->param_cnt];+ #ifdef SNMP+ if (symbol -> magic)+ return *assoc_lookup (symbol, concat_exp (subs, 1))+ != Nnull_string;+ #endif if (symbol->var_array == 0) return 0;+ #ifndef SNMP subs = concat_exp(subs);+ #else+ subs = concat_exp(subs,0);+ #endif hash1 = hash_calc(subs); if (assoc_find(symbol, subs, hash1) == NULL) { free_temp(subs);****************** 180,185 ****--- 213,224 ---- hash1 = hash_calc(subs); + #ifdef SNMP+ if (symbol -> magic) {+ snmp_get (symbol, force_string (subs) -> stptr);+ return &symbol -> var_value;+ }+ #endif if (symbol->var_array == 0) { /* this table really should grow * dynamically */ emalloc(symbol->var_array, NODE **, (sizeof(NODE *) ******************* 210,218 ****--- 249,265 ---- register NODE *bucket, *last; NODE *subs; + #ifdef SNMP+ if (symbol -> magic)+ fatal ("delete into SNMP array variable not allowed");+ #endif if (symbol->var_array == 0) return;+ #ifndef SNMP subs = concat_exp(tree);+ #else+ subs = concat_exp(tree,0);+ #endif hash1 = hash_calc(subs); last = NULL;****************** 234,244 ****--- 281,300 ---- } struct search *+ #ifndef SNMP assoc_scan(symbol)+ #else+ assoc_scan(symbol,instance)+ NODE *instance;+ #endif NODE *symbol; { struct search *lookat; + #ifdef SNMP+ if (symbol -> magic)+ return snmp_assoc_scan (symbol,instance);+ #endif if (!symbol->var_array) return 0; emalloc(lookat, struct search *, sizeof(struct search), "assoc_scan");****************** 245,257 ****--- 301,326 ---- lookat->numleft = ASSOC_HASHSIZE; lookat->arr_ptr = symbol->var_array; lookat->bucket = symbol->var_array[0];+ #ifndef SNMP return assoc_next(lookat);+ #else+ return assoc_next(symbol, lookat);+ #endif } struct search *+ #ifndef SNMP assoc_next(lookat)+ #else+ assoc_next(symbol, lookat)+ NODE *symbol;+ #endif struct search *lookat; {+ #ifdef SNMP+ if (symbol -> magic)+ return snmp_assoc_next (lookat, 0);+ #endif for (; lookat->numleft; lookat->numleft--) { while (lookat->bucket != 0) { lookat->retval = lookat->bucket->ahname;diff -rc gawk-2.11.orig/awk.h awk.h*** gawk-2.11.orig/awk.h Mon Nov 13 13:51:46 1989--- awk.h Mon May 20 16:17:28 1991****************** 62,68 **** #endif #ifdef __STDC__! extern void *malloc(unsigned), *realloc(void *, unsigned); extern void free(char *); extern char *getenv(char *); --- 62,68 ---- #endif #ifdef __STDC__! extern char *malloc(unsigned), *realloc(void *, unsigned); extern void free(char *); extern char *getenv(char *); ****************** 224,229 ****--- 224,235 ---- Node_K_while, /* lnode is condtional, rnode is stuff to run */ Node_K_for, /* lnode is for_struct, rnode is stuff to run */ Node_K_arrayfor, /* lnode is for_struct, rnode is stuff to run */+ #ifdef SNMP+ /* init: target+ cond: instance (optional)+ incr: array+ */+ #endif Node_K_break, /* no subs */ Node_K_continue, /* no stuff */ Node_K_print, /* lnode is exp_list, rnode is redirect */****************** 245,250 ****--- 251,259 ---- /* Variables */ Node_var, /* rnode is value, lnode is array stuff */+ #ifdef SNMP+ /* magic is pointer to (OT) */+ #endif Node_var_array, /* array is ptr to elements, asize num of * eles */ Node_val, /* node is a value - type in flags */****************** 298,303 ****--- 307,315 ---- char *name; short number; unsigned char recase;+ #ifdef SNMP+ caddr_t cookie;+ #endif } nodep; struct { AWKNUM fltnum; /* this is here for optimal packing of****************** 341,346 ****--- 353,361 ---- #define lnode sub.nodep.l.lptr #define nextp sub.nodep.l.nextnode #define rnode sub.nodep.r.rptr+ #ifdef SNMP+ #define magic sub.nodep.cookie+ #endif #define source_file sub.nodep.name #define source_line sub.nodep.number #define param_cnt sub.nodep.number****************** 533,539 ****--- 548,558 ---- extern NODE **get_lhs(NODE *, int); extern void do_deref(void ); extern struct search *assoc_scan(NODE *);+ #ifndef SNMP extern struct search *assoc_next(struct search *);+ #else SNMP+ extern struct search *assoc_next(NODE *symbol, struct search *lookat);+ #endif SNMP extern NODE **assoc_lookup(NODE *, NODE *); extern double r_force_number(NODE *); extern NODE *r_force_string(NODE *);****************** 608,610 ****--- 627,663 ---- #endif extern char casetable[]; /* for case-independent regexp matching */+ + + #ifdef SNMP+ extern NODE *AGENT_node,+ *COMMUNITY_node,+ *DIAGNOSTIC_node,+ *ERROR_node,+ *RETRIES_node,+ *TIMEOUT_node;+ + extern NODE *Ndot_string;+ + extern NODE *SET_node;+ extern NODE *SET_inst;+ + extern int snmp_enabled;+ extern char *snmp_file;+ + + #ifdef __STDC__+ int check_snmp(NODE *r, char *name);+ int snmp_get(NODE *ptr, char *instname);+ void snmp_set(void);+ char *snmp_name(NODE *ptr);+ struct search *snmp_assoc_scan(NODE *symbol);+ struct search *snmp_assoc_next(struct search *lookat, int done);+ #else+ int check_snmp ();+ int snmp_get ();+ void snmp_set ();+ char *snmp_name ();+ struct search *snmp_assoc_scan (), *snmp_assoc_next ();+ #endif+ #endifOnly in gawk-2.11.orig: awk.tab.cdiff -rc gawk-2.11.orig/awk.y awk.y*** gawk-2.11.orig/awk.y Mon Nov 13 13:51:48 1989--- awk.y Fri Aug 17 16:57:20 1990****************** 325,330 ****--- 325,335 ---- { $$ = node ($3, Node_K_while, $6); } | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls { $$ = node ($6, Node_K_do, $3); }+ | LEX_FOR '(' NAME LEX_IN NAME comma exp r_paren opt_nls statement+ {+ $$ = node ($10, Node_K_arrayfor, make_for_loop(variable($3),+ $7, variable($5)));+ } | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement { $$ = node ($8, Node_K_arrayfor, make_for_loop(variable($3),****************** 684,689 ****--- 689,697 ---- *do_split(), *do_system(), *do_int(), *do_close(), *do_atan2(), *do_sin(), *do_cos(), *do_rand(), *do_srand(), *do_match(), *do_tolower(), *do_toupper(),+ #ifdef SNMP+ *do_band (), *do_bor (),+ #endif *do_sub(), *do_gsub(); /* Special functions for debugging */****************** 697,702 ****--- 705,714 ---- { "BEGIN", Node_illegal, LEX_BEGIN, 0, 0 },
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?