diff options
author | tjr <tjr@FreeBSD.org> | 2005-08-30 12:32:18 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2005-08-30 12:32:18 +0000 |
commit | 71ef4ac3b5e694f4e964561d3e3156e7cca5a36c (patch) | |
tree | 5f4ed626393d4fee4f15485ce364e3b1b6a80dc7 /usr.bin/split | |
parent | d066ce1d4bdc71ea45d98ddec665cb97502585ae (diff) | |
download | FreeBSD-src-71ef4ac3b5e694f4e964561d3e3156e7cca5a36c.zip FreeBSD-src-71ef4ac3b5e694f4e964561d3e3156e7cca5a36c.tar.gz |
Remove undocumented historic support for treating "-" as an option
instead of a file operand; this is not compatible with POSIX.
Diffstat (limited to 'usr.bin/split')
-rw-r--r-- | usr.bin/split/split.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index e1978be..906d07a 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -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"); |