Allow "-" to be specified as an operand as well as an option.
SUSV3 requires something like "split -- -" to work. Document the "-" operand.
This commit is contained in:
@@ -50,8 +50,14 @@ The
|
|||||||
.Nm
|
.Nm
|
||||||
utility reads the given
|
utility reads the given
|
||||||
.Ar file
|
.Ar file
|
||||||
(or standard input if no file is specified)
|
|
||||||
and breaks it up into files of 1000 lines each.
|
and breaks it up into files of 1000 lines each.
|
||||||
|
If
|
||||||
|
.Ar file
|
||||||
|
is a single dash
|
||||||
|
.Pq Ql \&-
|
||||||
|
or absent,
|
||||||
|
.Nm
|
||||||
|
reads from the standard input.
|
||||||
.Pp
|
.Pp
|
||||||
The options are as follows:
|
The options are as follows:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
|
|||||||
@@ -142,7 +142,9 @@ main(argc, argv)
|
|||||||
|
|
||||||
if (*argv != NULL)
|
if (*argv != NULL)
|
||||||
if (ifd == -1) { /* Input file. */
|
if (ifd == -1) { /* Input file. */
|
||||||
if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
|
if (strcmp(*argv, "-") == 0)
|
||||||
|
ifd = STDIN_FILENO;
|
||||||
|
else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
|
||||||
err(EX_NOINPUT, "%s", *argv);
|
err(EX_NOINPUT, "%s", *argv);
|
||||||
++argv;
|
++argv;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user