diff options
Diffstat (limited to 'src/uanytun.c')
-rw-r--r-- | src/uanytun.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/uanytun.c b/src/uanytun.c index fa2a207..7c49934 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -179,16 +179,22 @@ int main(int argc, char* argv[]) log_init("uanytun", DAEMON); signal_init(); - log_printf(NOTICE, "just started..."); - options_t* opt; int ret = options_parse(&opt, argc, argv); if(ret) { - options_print_usage(); - log_printf(ERR, "error on options_parse, exitting"); + options_clear(&opt); + if(ret > 0) + fprintf(stderr, "syntax error near: %s\n\n", argv[ret]); + if(ret == -2) + fprintf(stderr, "memory error on options_parse, exitting\n"); + + if(ret == -1 || ret > 0) + options_print_usage(); + exit(ret); } + log_printf(NOTICE, "just started..."); tun_device_t* dev; tun_init(&dev, opt->dev_name_, opt->dev_type_, opt->ifconfig_param_local_, opt->ifconfig_param_remote_netmask_); |