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:
Tim J. Robbins 2005-08-30 12:32:18 +00:00
parent f2ba84d72d
commit bb78dba49b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149616

View file

@ -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");