| 1 |
|
/* |
| 2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
< |
* conf_lexer.l: Scans the ircd configuration file for tokens. |
| 2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 4 |
> |
* Copyright (c) 2000-2014 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 17 |
|
* along with this program; if not, write to the Free Software |
| 18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 19 |
|
* USA |
| 20 |
< |
* |
| 21 |
< |
* $Id$ |
| 20 |
> |
*/ |
| 21 |
> |
|
| 22 |
> |
/*! \file ircd_lexer.l |
| 23 |
> |
* \brief Scans the ircd configuration file for tokens. |
| 24 |
> |
* \version $Id$ |
| 25 |
|
*/ |
| 26 |
|
|
| 27 |
|
%option case-insensitive |
| 40 |
|
#define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg) |
| 41 |
|
#define YY_INPUT(buf,result,max_size) \ |
| 42 |
|
if (!(result = conf_yy_input(buf, max_size))) \ |
| 43 |
< |
YY_FATAL_ERROR("input in flex scanner failed"); |
| 43 |
> |
YY_FATAL_ERROR("input in flex scanner failed"); |
| 44 |
|
#define MAX_INCLUDE_DEPTH 10 |
| 45 |
|
|
| 46 |
|
|
| 79 |
|
|
| 80 |
|
%% |
| 81 |
|
{include} { cinclude(); } |
| 82 |
< |
"/*" { ccomment(); } |
| 82 |
> |
"/*" { ccomment(); } |
| 83 |
|
|
| 84 |
< |
\n.* { strlcpy(linebuf, yytext+1, sizeof(linebuf)); ++lineno; yyless(1); } |
| 84 |
> |
\n.* { strlcpy(linebuf, yytext+1, sizeof(linebuf)); ++lineno; yyless(1); } |
| 85 |
|
|
| 86 |
|
{WS} ; |
| 87 |
|
{COMMENT} ; |
| 103 |
|
int i,j; |
| 104 |
|
|
| 105 |
|
yylval.string[yyleng-2] = '\0'; /* remove close |
| 106 |
< |
* quote |
| 106 |
> |
* quote |
| 107 |
|
*/ |
| 108 |
< |
|
| 108 |
> |
|
| 109 |
|
for (j=i=0 ;yylval.string[i] != '\0'; i++,j++) |
| 110 |
|
{ |
| 111 |
|
if (yylval.string[i] != '\\') |
| 115 |
|
else |
| 116 |
|
{ |
| 117 |
|
i++; |
| 118 |
< |
if (yylval.string[i] == '\0') /* XXX |
| 118 |
> |
if (yylval.string[i] == '\0') /* XXX |
| 119 |
|
* should not |
| 120 |
|
* happen |
| 121 |
|
*/ |
| 340 |
|
unxline { return T_UNXLINE; } |
| 341 |
|
use_egd { return USE_EGD; } |
| 342 |
|
use_logging { return USE_LOGGING; } |
| 343 |
< |
user { return USER; } |
| 343 |
> |
user { return USER; } |
| 344 |
|
vhost { return VHOST; } |
| 345 |
|
vhost6 { return VHOST6; } |
| 346 |
|
wallop { return T_WALLOP; } |
| 414 |
|
YY_FATAL_ERROR("EOF in comment"); |
| 415 |
|
/* XXX hack alert this disables |
| 416 |
|
* the stupid unused function warning |
| 417 |
< |
* gcc generates |
| 417 |
> |
* gcc generates |
| 418 |
|
*/ |
| 419 |
|
if (1 == 0) |
| 420 |
|
yy_fatal_error("EOF in comment"); |
| 437 |
|
|
| 438 |
|
/* log(L_NOTICE, "got include %s!", c); */ |
| 439 |
|
|
| 440 |
< |
/* do stacking and co. */ |
| 440 |
> |
/* do stacking and co. */ |
| 441 |
|
if (include_stack_ptr >= MAX_INCLUDE_DEPTH) |
| 442 |
|
ilog(LOG_TYPE_IRCD, "Includes nested too deep in %s", p); |
| 443 |
|
else |
| 451 |
|
snprintf(filenamebuf, sizeof(filenamebuf), "%s/%s", ETCPATH, p); |
| 452 |
|
|
| 453 |
|
tmp_fbfile_in = fopen(filenamebuf, "r"); |
| 454 |
< |
|
| 454 |
> |
|
| 455 |
|
if (tmp_fbfile_in == NULL) |
| 456 |
|
{ |
| 457 |
|
ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s", |
| 494 |
|
yy_delete_buffer(YY_CURRENT_BUFFER); |
| 495 |
|
lineno = lineno_stack[include_stack_ptr]; |
| 496 |
|
conf_parser_ctx.conf_file = inc_fbfile_in[include_stack_ptr]; |
| 497 |
< |
strlcpy(conffilebuf, conffile_stack[include_stack_ptr], sizeof(conffilebuf)); |
| 497 |
> |
strlcpy(conffilebuf, conffile_stack[include_stack_ptr], sizeof(conffilebuf)); |
| 498 |
|
yy_switch_to_buffer(include_stack[include_stack_ptr]); |
| 499 |
|
|
| 500 |
|
return 0; |