Remove undocumented historic support for treating "-" as an option
instead of a file operand; this is not compatible with POSIX.
This commit is contained in:
parent
d066ce1d4b
commit
71ef4ac3b5
@ -88,7 +88,7 @@ main(int argc, char **argv)
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
while ((ch = getopt(argc, argv, "-0123456789a:b:l:p:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "0123456789a:b:l:p:")) != -1)
|
||||
switch (ch) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
@ -108,11 +108,6 @@ main(int argc, char **argv)
|
||||
"%s: illegal line count", optarg);
|
||||
}
|
||||
break;
|
||||
case '-': /* Undocumented: historic stdin flag. */
|
||||
if (ifd != -1)
|
||||
usage();
|
||||
ifd = 0;
|
||||
break;
|
||||
case 'a': /* Suffix length */
|
||||
if ((sufflen = strtol(optarg, &ep, 10)) <= 0 || *ep)
|
||||
errx(EX_USAGE,
|
||||
@ -153,14 +148,13 @@ main(int argc, char **argv)
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (*argv != NULL)
|
||||
if (ifd == -1) { /* Input file. */
|
||||
if (strcmp(*argv, "-") == 0)
|
||||
ifd = STDIN_FILENO;
|
||||
else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
|
||||
err(EX_NOINPUT, "%s", *argv);
|
||||
++argv;
|
||||
}
|
||||
if (*argv != NULL) { /* Input file. */
|
||||
if (strcmp(*argv, "-") == 0)
|
||||
ifd = STDIN_FILENO;
|
||||
else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
|
||||
err(EX_NOINPUT, "%s", *argv);
|
||||
++argv;
|
||||
}
|
||||
if (*argv != NULL) /* File name prefix. */
|
||||
if (strlcpy(fname, *argv++, sizeof(fname)) >= sizeof(fname))
|
||||
errx(EX_USAGE, "file name prefix is too long");
|
||||
|
Loading…
x
Reference in New Issue
Block a user