「🏗️」 wip: polished a little the prints and fix short opt not working
This commit is contained in:
10
src/main.c
10
src/main.c
@ -12,9 +12,9 @@ void init_args_t(args_t *args) {
|
||||
OPT_WHILE {
|
||||
args->opts[i] = false;
|
||||
args->arg[i] = NULL;
|
||||
args->hosts = NULL;
|
||||
i++;
|
||||
}
|
||||
args->hosts = NULL;
|
||||
}
|
||||
|
||||
int handle_options(args_t *args, char **av) {
|
||||
@ -25,7 +25,7 @@ int handle_options(args_t *args, char **av) {
|
||||
print_usage();
|
||||
return EX_USAGE;
|
||||
} else if (args->opts[2]) {
|
||||
printf("adjoly's %s: v%s\n", *av, FT_PING_V);
|
||||
print_version();
|
||||
return EXIT_SUCCESS;
|
||||
} else if (args->opts[1]) {
|
||||
print_help();
|
||||
@ -46,12 +46,10 @@ int main(int ac, char **av) {
|
||||
if (ret == -1) {
|
||||
free(args.hosts);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else if (ret != EXIT_SUCCESS) {
|
||||
} else if (ret != EXIT_SUCCESS) {
|
||||
free(args.hosts);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ret = handle_options(&args, av);
|
||||
free(args.hosts);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user