]> granicus.if.org Git - sudo/commitdiff
now have a rule that matches anything that doesn't match an explicite rule.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 29 Mar 1995 22:18:50 +0000 (22:18 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 29 Mar 1995 22:18:50 +0000 (22:18 +0000)
well, you know what i mean (. matches anything not yet matched).
However, this means that there is input still queued up so we need
to do a YY_NEW_FILE; in yywrap.  So, yywrap has moved into parse.lex
and it calls parser_cleanup() which is most of the old yywrap()
sigh.

parse.lex

index 775ca178fc25cb4b45d0e3df07fa611f119bb0cc..a26e659017449fd3d1f39b3cbb056e1d65184034 100644 (file)
--- a/parse.lex
+++ b/parse.lex
@@ -41,10 +41,13 @@ static char rcsid[] = "$Id$";
 #include "options.h"
 #include "y.tab.h"
 
+#undef yywrap          /* guard against a yywrap macro */
+
 extern YYSTYPE yylval;
 int sudolineno = 1;
 
 static int fill        __P((void));
+extern void parser_cleanup __P((void));
 
 #ifdef TRACELEXER
 #define LEXTRACE(msg)  fputs(msg, stderr)
@@ -87,11 +90,10 @@ N                   {D}{1,3}
                          LEXTRACE("\n");
                          return COMMENT;
                        }                       /* return comments */
-[@$%^&*()"'`/_+.]*     { return ERROR; }       /* return error */
-[?;<>\[\]{}|~-]*       { return ERROR; }       /* return error */
-[0-9_]+                        { return ERROR; }       /* return error */
-
-{N}\.{N}\.{N}\.{N}     { fill(); return NTWKADDR; }
+{N}\.{N}\.{N}\.{N}     {
+                         fill();
+                         return NTWKADDR;
+                       }
 
 \/([a-zA-Z0-9_.+-]+\/?)+ {
                          LEXTRACE("PATH ");
@@ -132,7 +134,19 @@ N                  {D}{1,3}
                          return ERROR;
                        }
 
+.                      { return ERROR; }       /* return error */
+
 %%
 static int fill() {
     (void) strcpy(yylval.string, yytext);
 }
+
+int yywrap()
+{
+#ifdef YY_NEW_FILE
+    YY_NEW_FILE;
+#endif /* YY_NEW_FILE */
+
+    parser_cleanup();
+    return(1);
+}