🏗️」 wip: work in progress, not done yet.

This commit is contained in:
2025-08-12 17:57:15 +02:00
parent bc57fe2cc2
commit f71753ffa8
6 changed files with 55 additions and 15 deletions

View File

@ -63,8 +63,13 @@ void print_parse_err(error_t err, char *opt) {
printf("%s: invalid option -- %s\n", exec_name, opt);
break;
case NEED_ARG:
printf("%s: option '--%s' requires an argument\n", exec_name, opt);
printf("%s: option '%s' requires an argument\n", exec_name, opt);
break;
case ERR_ARG:
printf("%s: option '%s' invalid argument \n", exec_name, opt);
break;
}
printf("Try 'ping --help' or 'ping --usage' for more information.\n");
}

View File

@ -11,7 +11,7 @@ char *exec_name;
void init_args_t(args_t *args) {
OPT_WHILE {
args->opts[i] = false;
args->arg[i] = NULL;
args->arg[i] = 0;
i++;
}
args->hosts = NULL;
@ -31,10 +31,8 @@ int handle_options(args_t *args, char **av) {
print_help();
return EXIT_SUCCESS;
} else {
for (int i = 0; args->hosts[i] != NULL; ++i)
printf("%s\n", args->hosts[i]);
return send_ping(args);
}
return EXIT_SUCCESS;
}
int main(int ac, char **av) {

5
src/send_ping.c Normal file
View File

@ -0,0 +1,5 @@
#include <opt_parse.h>
int send_ping(args_t *args) {
}