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
f2ba84d72d
commit
bb78dba49b
@ -88,7 +88,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
setlocale(LC_ALL, "");
|
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) {
|
switch (ch) {
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
@ -108,11 +108,6 @@ main(int argc, char **argv)
|
|||||||
"%s: illegal line count", optarg);
|
"%s: illegal line count", optarg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '-': /* Undocumented: historic stdin flag. */
|
|
||||||
if (ifd != -1)
|
|
||||||
usage();
|
|
||||||
ifd = 0;
|
|
||||||
break;
|
|
||||||
case 'a': /* Suffix length */
|
case 'a': /* Suffix length */
|
||||||
if ((sufflen = strtol(optarg, &ep, 10)) <= 0 || *ep)
|
if ((sufflen = strtol(optarg, &ep, 10)) <= 0 || *ep)
|
||||||
errx(EX_USAGE,
|
errx(EX_USAGE,
|
||||||
@ -153,8 +148,7 @@ main(int argc, char **argv)
|
|||||||
argv += optind;
|
argv += optind;
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
|
|
||||||
if (*argv != NULL)
|
if (*argv != NULL) { /* Input file. */
|
||||||
if (ifd == -1) { /* Input file. */
|
|
||||||
if (strcmp(*argv, "-") == 0)
|
if (strcmp(*argv, "-") == 0)
|
||||||
ifd = STDIN_FILENO;
|
ifd = STDIN_FILENO;
|
||||||
else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
|
else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user