diff --git a/src/main.c b/src/main.c index 2eb50da..ed3bb3b 100644 --- a/src/main.c +++ b/src/main.c @@ -265,8 +265,7 @@ int parse_argv(int argc, const char **argv, struct options *opts) { case 'a': opts->addressbook_path = argv[i+1]; ++i; continue; case 'v': return -2; case 'h': return -3; - default: - return -1; + default: return -1; } } else { if (opts->command == 'c' || opts->command == 's') { @@ -287,17 +286,13 @@ int parse_argv(int argc, const char **argv, struct options *opts) { } } - if (command_arg_num == 1) { - int r = inet_pton(AF_INET, opts->addr, NULL); - if (r == -1) - r = inet_pton(AF_INET6, opts->addr, NULL); - opts->is_alias_passed = r == 0; - } + int r = inet_pton(AF_INET, opts->addr, NULL); + if (r == -1) + r = inet_pton(AF_INET6, opts->addr, NULL); + opts->is_alias_passed = r == 0; - // opts->is_alias_passed = ((opts->addr[0]>>4) & 0xf) != 0x3; - if (opts->command == '\0' || opts->addr[0] == '\0' - || (!opts->is_alias_passed && opts->port[0] == '\0')) + || (!opts->is_alias_passed && opts->port == NULL)) return -1; return 0;