]> git.armaanb.net Git - opendoas.git/blobdiff - parse.y
missing semicolon at end of rule. yacc doesn't seem to mind, though. from Edakawa
[opendoas.git] / parse.y
diff --git a/parse.y b/parse.y
index 43732a6291144726e88e82d3925620394ddd9ea1..0863d75b86793c7bd8edeb620497112a0161a2a7 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -49,13 +49,26 @@ typedef struct {
 FILE *yyfp;
 
 struct rule **rules;
-int nrules, maxrules;
+int nrules;
+static int maxrules;
+
 int parse_errors = 0;
-int obsolete_warned = 0;
+static int obsolete_warned = 0;
+
+static void yyerror(const char *, ...);
+static int yylex(void);
 
-void yyerror(const char *, ...);
-int yylex(void);
-int yyparse(void);
+static size_t
+arraylen(const char **arr)
+{
+       size_t cnt = 0;
+
+       while (*arr) {
+               cnt++;
+               arr++;
+       }
+       return cnt;
+}
 
 %}
 
@@ -111,6 +124,10 @@ options:   /* none */ {
                } | options option {
                        $$.options = $1.options | $2.options;
                        $$.envlist = $1.envlist;
+                       if (($$.options & (NOPASS|PERSIST)) == (NOPASS|PERSIST)) {
+                               yyerror("can't combine nopass and persist");
+                               YYERROR;
+                       }
                        if ($2.envlist) {
                                if ($$.envlist) {
                                        yyerror("can't have two setenv sections");
@@ -149,7 +166,7 @@ envlist:    /* empty */ {
                                errx(1, "can't allocate envlist");
                        $$.envlist[nenv] = $2.str;
                        $$.envlist[nenv + 1] = NULL;
-               }
+               } ;
 
 
 ident:         TSTRING {
@@ -201,7 +218,7 @@ yyerror(const char *fmt, ...)
        parse_errors++;
 }
 
-struct keyword {
+static struct keyword {
        const char *word;
        int token;
 } keywords[] = {