summaryrefslogtreecommitdiff
path: root/src/tcpproxy.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-12-05 08:15:54 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-12-05 08:15:54 +0000
commit4a6fdccc8260e867fbf4dfd53b029ba085840f51 (patch)
tree8b3319d8613d02e5305d09d835e4c17bcf9bf4bb /src/tcpproxy.c
parentcheck wether config file was empty (diff)
cleaned parser a bit
better warnings if local-port and config-file are specified git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@30 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
Diffstat (limited to 'src/tcpproxy.c')
-rw-r--r--src/tcpproxy.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tcpproxy.c b/src/tcpproxy.c
index 57d86b3..3e30338 100644
--- a/src/tcpproxy.c
+++ b/src/tcpproxy.c
@@ -41,7 +41,7 @@
#include "clients.h"
extern FILE *yyin;
-extern void yyinit(options_t* opt, listeners_t* listeners);
+extern void yyinit(const char* config_file, listeners_t* listeners);
extern int yyparse(void);
@@ -169,11 +169,12 @@ int main(int argc, char* argv[])
exit(-1);
}
- yyinit(&opt, &listeners);
- yyparse();
-
- if(!slist_length(&listeners)) {
- log_printf(ERROR, "no listeners defined in config file %s", opt.config_file_);
+ yyinit(opt.config_file_, &listeners);
+ int ret = yyparse();
+ fclose(yyin);
+ if(ret || !slist_length(&listeners)) {
+ if(!ret)
+ log_printf(ERROR, "no listeners defined in config file %s", opt.config_file_);
listener_clear(&listeners);
options_clear(&opt);
log_close();