From 4a6fdccc8260e867fbf4dfd53b029ba085840f51 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 5 Dec 2010 08:15:54 +0000 Subject: 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 --- src/tcpproxy.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/tcpproxy.c') 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(); -- cgit v1.2.3