diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-07-21 08:42:59 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-07-21 08:42:59 +0530 |
commit | 15a55c7f85c5d624e29c453d3f1c3af015123cdf (patch) | |
tree | 851e07ee3d55add458735d931aff13a72e047708 /src | |
parent | f8bfd5e7dff88b911781a92e1ad87a7eba9342b9 (diff) |
evanix: pass optstring
Diffstat (limited to 'src')
-rw-r--r-- | src/evanix.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/evanix.c b/src/evanix.c index 7ed6768..bcebf69 100644 --- a/src/evanix.c +++ b/src/evanix.c @@ -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'}, @@ -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); @@ -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); } @@ -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); } @@ -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); } @@ -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); } |