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 | |
| 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')
| -rw-r--r-- | usr.bin/split/split.1 | 8 | ||||
| -rw-r--r-- | usr.bin/split/split.c | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/split/split.1 b/usr.bin/split/split.1 index cc2f1f54dcb..3158f529cce 100644 --- a/usr.bin/split/split.1 +++ b/usr.bin/split/split.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: split.1,v 1.9 2003/06/10 16:32:54 bjh21 Exp $ +.\" $NetBSD: split.1,v 1.10 2003/06/10 16:57:05 bjh21 Exp $ .\" .\" Copyright (c) 1990, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -50,8 +50,12 @@ The .Nm utility reads the given .Ar file -(or standard input if no file is specified) and breaks it up into files of 1000 lines each. +If +.Ar file +is a single dash or absent, +.Nm +reads from the standard input. .Pp The options are as follows: .Bl -tag -width Ds 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; } |
