Convert lexer to read using fileio.[ch] functions (thanks, Solaris!).
[ircu2.10.12-pk.git] / ircd / s_conf.c
index 1dc438b14591253982b44c46370664ae07fc4c83..96f2b99efed09ce18333be6e4218e5e1bcb1b2cd 100644 (file)
@@ -816,9 +816,9 @@ void clear_quarantines(void)
 static int conf_error;
 /** When non-zero, indicates that the configuration file was loaded at least once. */
 static int conf_already_read;
-extern FILE *yyin;
 extern void yyparse(void);
-extern void init_lexer(void);
+extern int init_lexer(void);
+extern void deinit_lexer(void);
 
 /** Read configuration file.
  * @return Zero on failure, non-zero on success. */
@@ -827,11 +827,10 @@ int read_configuration_file(void)
   conf_error = 0;
   feature_unmark(); /* unmark all features for resetting later */
   clear_nameservers(); /* clear previous list of DNS servers */
-  /* Now just open an fd. The buffering isn't really needed... */
-  init_lexer();
+  if (!init_lexer())
+    return 0;
   yyparse();
-  fclose(yyin);
-  yyin = NULL;
+  deinit_lexer();
   feature_mark(); /* reset unmarked features */
   conf_already_read = 1;
   return 1;