From 1d2e4fc2c3123d9d9503f71f7e5b7468ed81be16 Mon Sep 17 00:00:00 2001
From: Robert James Kaes <rjkaes@users.sourceforge.net>
Date: Fri, 13 Aug 2004 21:03:11 +0000
Subject: Change the code to use the new config_parse() method rather than the
 flex/bison based configuration system.

---
 src/tinyproxy.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/tinyproxy.c b/src/tinyproxy.c
index 578a10a..8c57a32 100644
--- a/src/tinyproxy.c
+++ b/src/tinyproxy.c
@@ -1,4 +1,4 @@
-/* $Id: tinyproxy.c,v 1.47 2004-01-26 19:11:51 rjkaes Exp $
+/* $Id: tinyproxy.c,v 1.48 2004-08-13 21:03:11 rjkaes Exp $
  *
  * The initialize routine. Basically sets up all the initial stuff (logfile,
  * listening socket, config options, etc.) and then sits there and loops
@@ -26,6 +26,7 @@
 
 #include "anonymous.h"
 #include "buffer.h"
+#include "conffile.h"
 #include "daemon.h"
 #include "heap.h"
 #include "filter.h"
@@ -38,9 +39,6 @@
 
 void takesig(int sig);
 
-extern int yyparse(void);
-extern FILE *yyin;
-
 /* 
  * Global Structures
  */
@@ -155,6 +153,7 @@ main(int argc, char **argv)
 	unsigned int godaemon = TRUE; /* boolean */
 	struct passwd *thisuser = NULL;
 	struct group *thisgroup = NULL;
+        FILE* config_file;
 
 	/*
 	 * Disable the creation of CORE files right up front.
@@ -212,14 +211,20 @@ main(int argc, char **argv)
 	/*
 	 * Read in the settings from the config file.
 	 */
-	yyin = fopen(config.config_file, "r");
-	if (!yyin) {
+        config_file = fopen(config.config_file, "r");
+        if (!config_file) {
 		fprintf(stderr,
 			"%s: Could not open configuration file \"%s\".\n",
 			argv[0], config.config_file);
 		exit(EX_SOFTWARE);
 	}
-	yyparse();
+        config_compile();
+        if (config_parse(&config, config_file) != 0) {
+                fprintf(stderr,
+                        "Unable to parse configuration file.  Not starting.\n");
+                exit(EX_SOFTWARE);
+        }
+        fclose(config_file);
 
 	/* Open the log file if not using syslog */
 	if (config.syslog == FALSE) {
-- 
cgit v1.2.3