%{
/*
- * 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.
*/
#include "config.h"
#include "fetchmail.h"
+#include "xmalloc.h"
#include "rcfile_y.h"
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;
}
sslcert { return SSLCERT; }
sslproto { return SSLPROTO; }
sslcertck { return SSLCERTCK; }
+sslcertfile { return SSLCERTFILE; }
sslcertpath { return SSLCERTPATH; }
sslcommonname { return SSLCOMMONNAME; }
sslfingerprint { return SSLFINGERPRINT; }
-?[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;
}