X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=rcfile_l.l;h=c7e49fea6999c97e6a17982940f19a8255838937;hb=ecade79a63e9abad933e3705a02533620ddc92b5;hp=6854851b90d5890de74a469dc7bfc5edf2cc65b2;hpb=1c6fb40e79a1344c35dcc69b292f9b6913cd4e95;p=~andy%2Ffetchmail diff --git a/rcfile_l.l b/rcfile_l.l index 6854851b..c7e49fea 100644 --- a/rcfile_l.l +++ b/rcfile_l.l @@ -9,6 +9,7 @@ #include "config.h" #include "fetchmail.h" +#include "xmalloc.h" #include "rcfile_y.h" int prc_lineno = 1; @@ -31,57 +32,20 @@ int prc_lineno = 1; %% -\"[^\"]*\" { - static char *in = NULL; - static size_t ins = 0; - - if ((size_t)yyleng + 1 > ins) { - ins = yyleng + 1; - in = (char *)xrealloc(in, ins); - } - memcpy(in, yytext, yyleng); - - in[yyleng-1] = '\0'; - escapes(in+1, in); - yyleng = strlen(in); - yylval.sval = in; - SETSTATE(0); - return STRING; - } +\"[^\"]*\" | \'[^\']*\' { - static char *in = NULL; - static size_t ins = 0; - - if ((size_t)yyleng + 1 > ins) { - ins = yyleng + 1; - in = (char *)xrealloc(in, ins); - } - memcpy(in, yytext, yyleng); - - in[yyleng-1] = '\0'; - escapes(in+1, in); - yyleng = strlen(in); + char *in = xstrndup(yytext+1, yyleng-2); + escapes(in, in); yylval.sval = in; - SETSTATE(0); + SETSTATE(0); return STRING; } -"*" { BEGIN(0); return WILDCARD; } - [^=;:, \t\r\n]+ { - static char *in = NULL; - static size_t ins = 0; - - 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; } @@ -208,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; } @@ -238,18 +203,8 @@ options {/* EMPTY */} -?[0-9]+ { yylval.number = atoi(yytext); return NUMBER; } [^=;:, \t\r\n]+ { - static char *in = NULL; - static size_t ins = 0; - - 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; return STRING; }