Quellcode durchsuchen

- fixed parse error for if (cond) a(); else b();
- fixed dbg. config dumping

Andrei Pelinescu-Onciul vor 20 Jahren
Ursprung
Commit
646aef6d3c
3 geänderte Dateien mit 27 neuen und 6 gelöschten Zeilen
  1. 1 1
      Makefile.defs
  2. 8 4
      cfg.y
  3. 18 1
      route_struct.c

+ 1 - 1
Makefile.defs

@@ -61,7 +61,7 @@ MAIN_NAME=ser
 VERSION = 0
 PATCHLEVEL = 10
 SUBLEVEL =   99
-EXTRAVERSION = -dev21-tcp
+EXTRAVERSION = -dev22-tcp
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 8 - 4
cfg.y

@@ -63,6 +63,7 @@
  * 2005-07-11 added DNS_RETR_TIME, DNS_RETR_NO, DNS_SERVERS_NO, DNS_USE_SEARCH,
  *             DNS_TRY_IPV6 (andrei)
  * 2005-07-12  default onreply route added (andrei)
+ * 2005-11-16  fixed if (cond) cmd; (andrei)
  *
  */
 
@@ -304,7 +305,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
 
 /*non-terminals */
 %type <expr> exp exp_elem /*, condition*/
-%type <action> action actions cmd if_cmd stm
+%type <action> action actions cmd if_cmd stm exp_stm
 %type <ipaddr> ipv4 ipv6 ipv6addr ip
 %type <ipnet> ipnet
 %type <strval> host
@@ -338,7 +339,6 @@ statement:	assign_stm
 		| {rt=FAILURE_ROUTE;} failure_route_stm
 		| {rt=ONREPLY_ROUTE;} onreply_route_stm
 		| {rt=BRANCH_ROUTE;} branch_route_stm
-
 		| CR	/* null statement*/
 	;
 
@@ -1050,7 +1050,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem(	$2, STRING_ST,
 		| MYSELF error	{ $$=0; 
 							yyerror ("invalid operator, == or != expected");
 						}
-		| stm				{ $$=mk_elem( NO_OP, ACTIONS_ST, ACTION_O, $1 ); }
+		| exp_stm			{ $$=mk_elem( NO_OP, ACTIONS_ST, ACTION_O, $1 );  }
 		| NUMBER		{$$=mk_elem( NO_OP, NUMBER_ST, NUMBER_O, (void*)$1 ); }
 	;
 
@@ -1095,11 +1095,15 @@ host:	ID				{ $$=$1; }
 	;
 
 
-stm:		cmd						{ $$=$1; }
+exp_stm:	cmd						{ $$=$1; }
 		|	if_cmd					{ $$=$1; }
 		|	LBRACE actions RBRACE	{ $$=$2; }
 	;
 
+stm:		action					{ $$=$1; }
+		|	LBRACE actions	RBRACE	{ $$=$2; }
+	;
+
 actions:	actions action	{$$=append_action($1, $2); }
 		| action			{$$=$1;}
 		| actions error { $$=0; yyerror("bad command"); }

+ 18 - 1
route_struct.c

@@ -162,10 +162,12 @@ void print_expr(struct expr* exp)
 			case DSTIP_O:
 				DBG("dstip");
 				break;
+			case DSTPORT_O:
+				DBG("dstport");
+				break;
 			case NUMBER_O:
 				break;
 			case ACTION_O:
-				print_action((struct action*) exp->r.param);
 				break;
 			default:
 				DBG("UNKNOWN");
@@ -179,6 +181,21 @@ void print_expr(struct expr* exp)
 				break;
 			case NO_OP:
 				break;
+			case GT_OP:
+				DBG(">");
+				break;
+			case GTE_OP:
+				DBG(">=");
+				break;
+			case LT_OP:
+				DBG("<");
+				break;
+			case LTE_OP:
+				DBG("<=");
+				break;
+			case DIFF_OP:
+				DBG("!=");
+				break;
 			default:
 				DBG("<UNKNOWN>");
 		}