#include <stdlib.h>
#include <string.h>
#include "config.h"
+#include "fileio.h"
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_string.h"
TOKEN(FAST),
TOKEN(AUTOCONNECT),
TOKEN(PROGRAM),
+ TOKEN(DNS),
#undef TOKEN
{ "administrator", ADMIN },
{ "apass_opmode", TPRIV_APASS_OPMODE },
{ "file", TFILE },
{ "force_local_opmode", TPRIV_FORCE_LOCAL_OPMODE },
{ "force_opmode", TPRIV_FORCE_OPMODE },
+ { "gb", GBYTES },
+ { "gigabytes", GBYTES },
{ "gline", TPRIV_GLINE },
+ { "ipv4", TOK_IPV4 },
+ { "ipv6", TOK_IPV6 },
{ "kb", KBYTES },
{ "kilobytes", KBYTES },
{ "list_chan", TPRIV_LIST_CHAN },
{ "mb", MBYTES },
{ "megabytes", MBYTES },
{ "mode_lchan", TPRIV_MODE_LCHAN },
- { "gb", GBYTES },
- { "gigabytes", GBYTES },
{ "operator", OPER },
{ "opmode", TPRIV_OPMODE },
{ "password", PASS },
return tok ? tok->value : 0;
}
-void
+static FBFILE *lexer_input;
+
+#undef YY_INPUT
+#define YY_INPUT(buf, res, size) res = (fbgets(buf, size, lexer_input) ? strlen(buf) : 0)
+
+int
init_lexer(void)
{
- yyin = fopen(configfile, "r");
- if (yyin == NULL)
+ lexer_input = fbopen(configfile, "r");
+ if (lexer_input == NULL)
{
#ifdef YY_FATAL_ERROR
YY_FATAL_ERROR("Could not open the configuration file.");
#else
fprintf(stderr, "Could not open the configuration file.");
#endif
+ return 0;
}
#ifdef YY_NEW_FILE
YY_NEW_FILE;
#endif
lineno = 1;
+ return 1;
+}
+
+void deinit_lexer(void)
+{
+ if (lexer_input != NULL)
+ {
+ fbclose(lexer_input);
+ lexer_input = NULL;
+ }
+}
+
+int
+yywrap(void)
+{
+ return 1;
}
%}
{WHITE} ;
{SHCOMMENT} ;
-[a-zA-Z_]+ { int res = find_token(yytext); if (res) return res; else REJECT; }
+[a-zA-Z_][a-zA-Z_0-9]* { int res = find_token(yytext); if (res) return res; else REJECT; }
\n lineno++;
. return yytext[0];