pbft/parse.c
2025-01-25 00:01:36 -05:00

29 lines
419 B
C

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
extern char *optarg;
char *f_host;
int parse(int argc, char **argv) {
char opt;
bool h;
while ((opt = getopt(argc, argv, "h:")) != EOF) {
switch (opt) {
case 'h':
f_host = optarg;
h = true;
break;
}
}
if (!h) {
printf("Please provide all arguments.\n");
exit(1);
}
return optind;
}