Commit f776f62c authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

don't use getopt() GNU extension

parent 652658d8
...@@ -237,7 +237,7 @@ void parse_options(int argc, char **argv) ...@@ -237,7 +237,7 @@ void parse_options(int argc, char **argv)
exit(1); exit(1);
} }
while ((opt = getopt(argc, argv, "-hLDCqi:w:s:S:c:o:p:")) != -1) { while ((opt = getopt(argc, argv, "hLDCqi:w:s:S:c:o:p:")) != -1) {
switch (opt) { switch (opt) {
case 'h': case 'h':
usage(); usage();
...@@ -275,22 +275,17 @@ void parse_options(int argc, char **argv) ...@@ -275,22 +275,17 @@ void parse_options(int argc, char **argv)
case 'c': case 'c':
count = parse_int(optarg); count = parse_int(optarg);
break; break;
case 1:
if (path) {
errx(1, "more than one destination: "
"\"%s\" and \"%s\"",
path, optarg);
}
path = optarg;
break;
case '?': case '?':
usage(); usage();
exit(1); exit(1);
} }
} }
if (!path) if (optind > argc-1)
errx(1, "no destination specified"); errx(1, "no destination specified");
if (optind < argc-1)
errx(1, "more than one destination specified");
path = argv[optind];
} }
#ifdef __linux__ #ifdef __linux__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment