🏗️」 wip: parsing kinda working

This commit is contained in:
2025-08-11 21:52:57 +02:00
parent 8f1abd7940
commit e635977c88
6 changed files with 105 additions and 41 deletions

View File

@ -4,18 +4,35 @@
#include <stdio.h>
void print_help(void) {
uint16_t i = 0;
printf("Usage: ping [OPTION...] HOST ...\n");
printf("Send ICMP ECHO_REQUEST packets to network hosts.\n\n");
while (i < OPT_NB) {
printf(" -%c, --%s:\t %s\n", options[i].opt, options[i].name, options[i].doc);
printf(" All the mandatory options : \n");
OPT_WHILE {
if (options[i].grp == 1)
printf(" -%c, --%s:\t %s\n", options[i].opt, options[i].name,
options[i].doc);
i++;
}
printf("\nMandatory or optional arguments to long options are also mandatory "
"or optional\nfor any corresponding short options.\n\n");
printf("Report bugs to <noreply@adjoly.fr> (pls don't).\n");
i = 0;
printf(" All the bonuses options : \n");
while (i < OPT_NB) {
if (options[i].grp == 2)
printf(" -%c, --%s:\t %s\n", options[i].opt, options[i].name,
options[i].doc);
i++;
}
printf(" All the prints and help function : \n");
while (i < OPT_NB) {
if (options[i].grp == 0)
printf(" -%c, --%s:\t %s\n", options[i].opt, options[i].name,
options[i].doc);
i++;
}
printf(
"\nMandatory or optional arguments to long options are also mandatory "
"or optional\nfor any corresponding short options.\n\n");
printf("Report bugs to <noreply@adjoly.fr> :D.\n");
}
void print_no_host(char *av) {