diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-05-27 05:27:10 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-05-27 05:27:10 +0000 |
| commit | 3e4228c3be79a29055ab1143cbc5666078a3771f (patch) | |
| tree | ddc5dd56ed26b8a5c558eef2cd8398265128a639 | |
| parent | ad308c10c733179e475547bd3b0801ddfa7d5511 (diff) | |
Notes
| -rw-r--r-- | usr.bin/split/split.1 | 8 | ||||
| -rw-r--r-- | usr.bin/split/split.c | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/split/split.1 b/usr.bin/split/split.1 index d6305cea4627..c4c3feee8aa3 100644 --- a/usr.bin/split/split.1 +++ b/usr.bin/split/split.1 @@ -50,8 +50,14 @@ 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 +.Pq Ql \&- +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 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; } |
