「🏗️」 wip: parsing should be good
This commit is contained in:
27
src/help.c
27
src/help.c
@ -1,8 +1,10 @@
|
||||
#include "ping.h"
|
||||
#include <help.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void print_help(void) {
|
||||
printf("Usage: ping [OPTION...] HOST ...\n");
|
||||
@ -52,7 +54,26 @@ void print_help(void) {
|
||||
printf("Report bugs to <noreply@adjoly.fr> :D.\n");
|
||||
}
|
||||
|
||||
void print_no_host(char *av) {
|
||||
printf("%s: missing host operand\n", av);
|
||||
printf("Try 'ping --help' or 'ping -?' for more information.\n");
|
||||
void print_parse_err(error_t err, char *opt) {
|
||||
switch (err) {
|
||||
case MISSING_HOST:
|
||||
printf("%s: missing host operand\n", exec_name);
|
||||
break;
|
||||
case INVALID_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("Try 'ping --help' or 'ping --usage' for more information.\n");
|
||||
}
|
||||
|
||||
void print_usage(void) {
|
||||
printf("Usage %s:", exec_name);
|
||||
OPT_WHILE {
|
||||
printf(" [--%s] ", options[i].name);
|
||||
i++;
|
||||
}
|
||||
printf("HOST ...\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user