X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fircd_lexer.l;h=8e6b55ff4c3658f564b92226b298ab8b534d6f2a;hb=refs%2Fheads%2Fupstream;hp=0df1f707437dda00f5efa20a389570a9f64f5f68;hpb=67f7b0c2db69296b199c513a499831eebe1fc48d;p=ircu2.10.12-pk.git diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index 0df1f70..8e6b55f 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -26,6 +26,7 @@ #include #include #include "config.h" +#include "fileio.h" #include "ircd.h" #include "ircd_alloc.h" #include "ircd_string.h" @@ -102,6 +103,12 @@ static struct lexer_token { TOKEN(USERMODE), TOKEN(FAST), TOKEN(AUTOCONNECT), + TOKEN(PROGRAM), + TOKEN(DNS), + TOKEN(SSL), + TOKEN(CERTFILE), + TOKEN(KEYFILE), + TOKEN(CAFILE), #undef TOKEN { "administrator", ADMIN }, { "apass_opmode", TPRIV_APASS_OPMODE }, @@ -115,9 +122,14 @@ static struct lexer_token { { "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 }, { "local_badchan", TPRIV_LOCAL_BADCHAN }, { "local_gline", TPRIV_LOCAL_GLINE }, { "local_jupe", TPRIV_LOCAL_JUPE }, @@ -126,8 +138,6 @@ static struct lexer_token { { "mb", MBYTES }, { "megabytes", MBYTES }, { "mode_lchan", TPRIV_MODE_LCHAN }, - { "gb", GBYTES }, - { "gigabytes", GBYTES }, { "operator", OPER }, { "opmode", TPRIV_OPMODE }, { "password", PASS }, @@ -143,6 +153,7 @@ static struct lexer_token { { "tb", TBYTES }, { "terabytes", TBYTES }, { "unlimit_query", TPRIV_UNLIMIT_QUERY }, + { "unlimit_flood", TPRIV_UNLIMIT_FLOOD }, { "walk_lchan", TPRIV_WALK_LCHAN }, { "wide_gline", TPRIV_WIDE_GLINE }, { "whox", TPRIV_WHOX }, @@ -180,22 +191,44 @@ find_token(char *token) 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; } %} @@ -211,6 +244,6 @@ QSTRING \"[^"\n]+[\"\n] {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];