diff options
| author | bjh21 <bjh21@NetBSD.org> | 2003-06-10 16:57:05 +0000 |
|---|---|---|
| committer | bjh21 <bjh21@NetBSD.org> | 2003-06-10 16:57:05 +0000 |
| commit | 0b52d9cd7b7458fe2d1b04d6cfe3499e6b5381fa (patch) | |
| tree | a6cef1708ba63a7f7d4b477d7a38b616904fec39 /usr.bin/split/split.c | |
| parent | 2ef4680e17c210f317a5813d67d51289854256a5 (diff) | |
From FreeBSD:
Allow "-" to be specified as an operand as well as an option.
SUSV3 requires something like "split -- -" to work. Document the "-" operand.
Diffstat (limited to 'usr.bin/split/split.c')
| -rw-r--r-- | usr.bin/split/split.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index 18de97a73a8..29d3f430c57 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -1,4 +1,4 @@ -/* $NetBSD: split.c,v 1.10 2003/06/10 16:32:54 bjh21 Exp $ */ +/* $NetBSD: split.c,v 1.11 2003/06/10 16:57:05 bjh21 Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)split.c 8.3 (Berkeley) 4/25/94"; #endif -__RCSID("$NetBSD: split.c,v 1.10 2003/06/10 16:32:54 bjh21 Exp $"); +__RCSID("$NetBSD: split.c,v 1.11 2003/06/10 16:57:05 bjh21 Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -98,7 +98,7 @@ main(int argc, char *argv[]) "%s: illegal line count.", optarg); } break; - case '-': /* Undocumented: historic stdin flag. */ + case '-': /* stdin flag. */ if (ifd != -1) usage(); ifd = 0; @@ -130,7 +130,9 @@ main(int argc, char *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(1, "%s", *argv); ++argv; } |
