* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: ircd_lexer.l 3540 2007-07-30 17:26:00Z jilles $
*/
%option case-insensitive
#include <sys/types.h>
#include <sys/stat.h>
-#include <netinet/in.h>
-
#include <string.h>
#include <errno.h>
#include <limits.h>
#include "stdinc.h"
#include "ircd_defs.h"
-#include "common.h"
-#include "config.h"
+#include "defaults.h"
#include "logger.h"
#include "s_conf.h"
#include "newconf.h"
-#include "y.tab.h"
+#include "ircd_parser.h"
int yylex(void);
void hashcomment(void);
int ieof(void);
int lineno_stack[MAX_INCLUDE_DEPTH];
-char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE];
-char conffilebuf[IRCD_BUFSIZE+1];
+char conffile_stack[MAX_INCLUDE_DEPTH][BUFSIZE];
+char conffilebuf[BUFSIZE+1];
char *current_file = conffilebuf;
FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH];
-char linebuf[512];
+char yy_linebuf[16384];
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \
- YY_FATAL_ERROR("input in flex scanner failed");
+ YY_FATAL_ERROR("input in flex scanner failed");
%}
ws [ \t]*
%%
{include} { cinclude(); }
"/*" { ccomment(); }
-\n.* { strcpy(linebuf, yytext+1); lineno++; yyless(1); }
+\n.* { rb_strlcpy(yy_linebuf, yytext+1, sizeof(yy_linebuf)); lineno++; yyless(1); }
{ws} ;
{comment} { hashcomment(); }
{
int i,j;
yylval.string[yyleng-2] = '\0'; /* remove close
- * quote
+ * quote
*/
-
+
for (j=i=0 ;yylval.string[i] != '\0'; i++,j++)
{
if (yylval.string[i] != '\\')
else
{
i++;
- if (yylval.string[i] == '\0') /* XXX
+ if (yylval.string[i] == '\0') /* XXX
* should not
* happen
*/
loadmodule { return LOADMODULE; }
-{string} {
+{string} {
strcpy(yylval.string, yytext);
yylval.string[yyleng] = '\0';
return STRING;
void ccomment()
{
int c;
-
+
/* log(L_NOTICE, "got comment"); */
while (1)
{
if (c == '*')
{
while ((c = input()) == '*');
- if (c == '/')
+ if (c == '/')
break;
if (c == '\n') ++lineno;
}
else
*strchr(++c, '>') = 0;
- /* do stacking and co. */
+ /* do stacking and co. */
if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH);
else
{
FILE *tmp_fbfile_in;
-
+
tmp_fbfile_in = fopen(c, "r");
-
+
if (tmp_fbfile_in == NULL)
{
- /* if its not found in PREFIX, look in ETCPATH */
- char fnamebuf[IRCD_BUFSIZE];
+ /* if its not found in PREFIX, look in IRCD_PATH_ETC */
+ char fnamebuf[BUFSIZE];
- snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c);
+ snprintf(fnamebuf, sizeof(fnamebuf), "%s%c%s", ircd_paths[IRCD_PATH_ETC], RB_PATH_SEPARATOR, c);
tmp_fbfile_in = fopen(fnamebuf, "r");
/* wasnt found there either.. error. */
if (strlen(yytext) < sizeof(INCLUDE) - 1)
return;
- if (!strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1))
+ if (!rb_strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1))
yyerror("You probably meant '.include', skipping");
}