Skip to content

Commit

Permalink
evanix: pass optstring
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanmohd committed Jul 21, 2024
1 parent f8bfd5e commit 15a55c7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/evanix.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int main(int argc, char *argv[])
{
extern int optind, opterr, optopt;
extern char *optarg;
int ret, longindex;
int ret, longindex, c;

static struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
Expand All @@ -138,9 +138,9 @@ int main(int argc, char *argv[])
{NULL, 0, NULL, 0},
};

while ((ret = getopt_long(argc, argv, "", longopts, &longindex)) !=
-1) {
switch (ret) {
while ((c = getopt_long(argc, argv, "hfds:r::m:p:c:l:", longopts,
&longindex)) != -1) {
switch (c) {
case 'h':
printf("%s", usage);
exit(EXIT_SUCCESS);
Expand All @@ -161,11 +161,11 @@ int main(int argc, char *argv[])
ret = atoi(optarg);
if (ret <= 0) {
fprintf(stderr,
"option --%s requires a natural number "
"option -%c requires a natural number "
"argument\n"
"Try 'evanix --help' for more "
"information.\n",
longopts[longindex].name);
c);
exit(EXIT_FAILURE);
}

Expand All @@ -175,10 +175,10 @@ int main(int argc, char *argv[])
ret = atob(optarg);
if (ret < 0) {
fprintf(stderr,
"option --%s requires a bool argument\n"
"option -%c requires a bool argument\n"
"Try 'evanix --help' for more "
"information.\n",
longopts[longindex].name);
c);
exit(EXIT_FAILURE);
}

Expand All @@ -188,10 +188,10 @@ int main(int argc, char *argv[])
ret = atob(optarg);
if (ret < 0) {
fprintf(stderr,
"option --%s requires a bool argument\n"
"option -%c requires a bool argument\n"
"Try 'evanix --help' for more "
"information.\n",
longopts[longindex].name);
c);
exit(EXIT_FAILURE);
}

Expand All @@ -201,10 +201,10 @@ int main(int argc, char *argv[])
ret = atob(optarg);
if (ret < 0) {
fprintf(stderr,
"option --%s requires a bool argument\n"
"option -%c requires a bool argument\n"
"Try 'evanix --help' for more "
"information.\n",
longopts[longindex].name);
c);
exit(EXIT_FAILURE);
}

Expand Down

0 comments on commit 15a55c7

Please sign in to comment.