]> Pileus Git - ~andy/fetchmail/blobdiff - rcfile_l.l
Update info on the mimedecode fix.
[~andy/fetchmail] / rcfile_l.l
index 8dcd8af1b0a99acdc6d047a1abe8b5a0b522d874..c7e49fea6999c97e6a17982940f19a8255838937 100644 (file)
@@ -1,7 +1,7 @@
 %{
 
 /*
- * rcfile_l.l -- lexer for the run control file
+ * rcfile_l.l -- lexer for the run control file, to be used with GNU flex.
  *
  * For license terms, see the file COPYING in this directory.
  */
@@ -9,6 +9,7 @@
 
 #include "config.h"
 #include "fetchmail.h"
+#include "xmalloc.h"
 #include "rcfile_y.h"
 
 int prc_lineno = 1;
@@ -23,49 +24,28 @@ int prc_lineno = 1;
 
 %}
 
-/* this doesn't work with Linux lex, see the INSTALL file */
-%o 7000
-%a 4000
-%p 3000
 %option nounput noyywrap
+%option warn nodefault
+%option 8bit batch
 
 %s NAME AUTH
 
 %%
 
-\"[^\"]*\"     {
-                       yytext[yyleng-1] = '\0';
-                       escapes(yytext+1, yytext);
-                       yyleng = strlen(yytext);
-                       yylval.sval = yytext;
-                        SETSTATE(0);
-                       return STRING;
-               }
+\"[^\"]*\"     |
 \'[^\']*\'     {
-                       yytext[yyleng-1] = '\0';
-                       escapes(yytext+1, yytext);
-                       yyleng = strlen(yytext);
-                       yylval.sval = yytext;
-                        SETSTATE(0);
+                       char *in = xstrndup(yytext+1, yyleng-2);
+                       escapes(in, in);
+                       yylval.sval = in;
+                       SETSTATE(0);
                        return STRING;
                }
 
-"*"            { BEGIN(0); return WILDCARD; }
-
 <NAME>[^=;:, \t\r\n]+  {
-                       static char *in;
-                       static size_t ins;
-
-                       if ((size_t)yyleng + 1 > ins) {
-                           ins = yyleng + 1;
-                           in = (char *)xrealloc(in, ins);
-                       }
-                       memcpy(in, yytext, yyleng);
-                       in[yyleng] = '\0';
+                       char *in = xstrdup(yytext);
                        escapes(in, in);
-                       yyleng = strlen(in);
                        yylval.sval = in;
-                        SETSTATE(0);
+                       SETSTATE(0);
                        return STRING;
                }
 
@@ -192,6 +172,7 @@ sslkey              { return SSLKEY; }
 sslcert                { return SSLCERT; }
 sslproto       { return SSLPROTO; }
 sslcertck      { return SSLCERTCK; }
+sslcertfile    { return SSLCERTFILE; }
 sslcertpath    { return SSLCERTPATH; }
 sslcommonname  { return SSLCOMMONNAME; }
 sslfingerprint { return SSLFINGERPRINT; }
@@ -222,9 +203,9 @@ options             {/* EMPTY */}
 -?[0-9]+       { yylval.number = atoi(yytext); return NUMBER; }
 
 [^=;:, \t\r\n]+        {
-                       escapes(yytext, yytext);
-                       yyleng = strlen(yytext);
-                       yylval.sval = yytext;
+                       char *in = xstrdup(yytext);
+                       escapes(in, in);
+                       yylval.sval = in;
                        return STRING;
                }