X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=rcfile_l.l;h=c7e49fea6999c97e6a17982940f19a8255838937;hb=057d4d421c32c0458f7be320978d36b553a609cd;hp=8dcd8af1b0a99acdc6d047a1abe8b5a0b522d874;hpb=05cb2b9c62b323a1278c81b6cbe00b2e4186b4f4;p=~andy%2Ffetchmail diff --git a/rcfile_l.l b/rcfile_l.l index 8dcd8af1..c7e49fea 100644 --- a/rcfile_l.l +++ b/rcfile_l.l @@ -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; } - [^=;:, \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; }