「🏗️」 wip: wtf is this
This commit is contained in:
14
src/main.c
14
src/main.c
@ -6,18 +6,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *exec_name;
|
||||
char *exec_name;
|
||||
double *times = NULL;
|
||||
int rx_count = 0;
|
||||
int tx_count = 0;
|
||||
|
||||
void init_args_t(args_t *args) {
|
||||
OPT_WHILE {
|
||||
args->opts[i] = false;
|
||||
args->arg[i] = 0;
|
||||
args->arg[i] = -1;
|
||||
i++;
|
||||
}
|
||||
args->hosts = NULL;
|
||||
}
|
||||
|
||||
int handle_options(args_t *args, char **av) {
|
||||
int handle_options(args_t *args) {
|
||||
if (args->opts[1]) {
|
||||
print_help();
|
||||
return EXIT_SUCCESS;
|
||||
@ -37,8 +40,11 @@ int handle_options(args_t *args, char **av) {
|
||||
|
||||
int main(int ac, char **av) {
|
||||
exec_name = *av;
|
||||
|
||||
args_t args;
|
||||
|
||||
init_args_t(&args);
|
||||
|
||||
if (ac > 1) {
|
||||
int ret = opt_parse(av, &args);
|
||||
if (ret == -1) {
|
||||
@ -48,7 +54,7 @@ int main(int ac, char **av) {
|
||||
free(args.hosts);
|
||||
return ret;
|
||||
} else {
|
||||
ret = handle_options(&args, av);
|
||||
ret = handle_options(&args);
|
||||
free(args.hosts);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user