]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added rule "bool" for boolean switches.
authorMartin Mares <mj@ucw.cz>
Sun, 6 Dec 1998 17:38:42 +0000 (17:38 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 6 Dec 1998 17:38:42 +0000 (17:38 +0000)
conf/confbase.Y

index 24fff87b9aa27ee1ec8860097eaaa86047afdd9c..8e3212993d86394c83e4a1c5e5fb14f96b4ec4fe 100644 (file)
@@ -15,6 +15,7 @@ CF_HDR
 #include "lib/timer.h"
 #include "nest/protocol.h"
 #include "nest/iface.h"
+#include "nest/route.h"
 
 CF_DECLS
 
@@ -31,12 +32,12 @@ CF_DECLS
 %token <s> SYM
 %token <t> TEXT
 
-%type <i> expr
+%type <i> expr bool
 
 %left '+' '-'
 %left '*' '/' '%'
 
-CF_KEYWORDS(DEFINE)
+CF_KEYWORDS(DEFINE, ON, OFF, YES, NO)
 
 CF_GRAMMAR
 
@@ -76,6 +77,17 @@ definition:
    }
  ;
 
+/* Switches */
+
+bool:
+   expr {$$ = !!$1; }
+ | ON { $$ = 1; }
+ | YES { $$ = 1; }
+ | OFF { $$ = 0; }
+ | NO { $$ = 0; }
+ | /* Silence means agreement */ { $$ = 1; }
+ ;
+
 CF_CODE
 
 CF_END