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;
+}
%}
} | 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");
errx(1, "can't allocate envlist");
$$.envlist[nenv] = $2.str;
$$.envlist[nenv + 1] = NULL;
- }
+ } ;
ident: TSTRING {
parse_errors++;
}
-struct keyword {
+static struct keyword {
const char *word;
int token;
} keywords[] = {