Since a user can pass a port as well as an alias let's check for it every time.
This commit is contained in:
parent
9288797c03
commit
489d885049
@ -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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
Loading…
Reference in New Issue
Block a user