aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/split/split.c
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-05-27 05:27:10 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-05-27 05:27:10 +0000
commit3e4228c3be79a29055ab1143cbc5666078a3771f (patch)
treeddc5dd56ed26b8a5c558eef2cd8398265128a639 /usr.bin/split/split.c
parentad308c10c733179e475547bd3b0801ddfa7d5511 (diff)
Allow "-" to be specified as an operand as well as an option.
SUSV3 requires something like "split -- -" to work. Document the "-" operand.
Notes
Notes: svn path=/head/; revision=97334
Diffstat (limited to 'usr.bin/split/split.c')
-rw-r--r--usr.bin/split/split.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 9eb56a172201..00ea6711bd69 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -142,7 +142,9 @@ main(argc, argv)
if (*argv != NULL)
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);
++argv;
}