Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/split Remove support for treating "-" as an option r...
details: https://anonhg.NetBSD.org/src/rev/dd89d4a8aea0
branches: trunk
changeset: 548449:dd89d4a8aea0
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Thu Jun 26 23:06:52 2003 +0000
description:
Remove support for treating "-" as an option rather than an operand. The
practical consequence of this is that "-" is treated the same as a file name,
and can't have options specified after it. This is consistent with other
utilities and with POSIX.
diffstat:
usr.bin/split/split.c | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
diffs (61 lines):
diff -r 56ff0b51ad85 -r dd89d4a8aea0 usr.bin/split/split.c
--- a/usr.bin/split/split.c Thu Jun 26 23:00:07 2003 +0000
+++ b/usr.bin/split/split.c Thu Jun 26 23:06:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: split.c,v 1.14 2003/06/26 22:49:53 bjh21 Exp $ */
+/* $NetBSD: split.c,v 1.15 2003/06/26 23:06:52 bjh21 Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)split.c 8.3 (Berkeley) 4/25/94";
#endif
-__RCSID("$NetBSD: split.c,v 1.14 2003/06/26 22:49:53 bjh21 Exp $");
+__RCSID("$NetBSD: split.c,v 1.15 2003/06/26 23:06:52 bjh21 Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -81,7 +81,7 @@
size_t namelen;
long name_max;
- while ((ch = getopt(argc, argv, "-0123456789b:l:a:")) != -1)
+ while ((ch = getopt(argc, argv, "0123456789b:l:a:")) != -1)
switch (ch) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
@@ -100,11 +100,6 @@
errx(1, "%s: illegal line count.", p);
}
break;
- case '-': /* stdin flag. */
- if (ifd != -1)
- usage();
- ifd = 0;
- break;
case 'b': /* Byte count. */
if (!isdigit((unsigned char)optarg[0]) ||
(bytecnt = strtoull(optarg, &ep, 10)) == 0 ||
@@ -135,14 +130,13 @@
argv += optind;
argc -= optind;
- if (*argv != NULL)
- if (ifd == -1) { /* Input file. */
- if (strcmp(*argv, "-") == 0)
- ifd = STDIN_FILENO;
- else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
- err(1, "%s", *argv);
- ++argv;
- }
+ if (*argv != NULL) {
+ if (strcmp(*argv, "-") == 0)
+ ifd = STDIN_FILENO;
+ else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
+ err(1, "%s", *argv);
+ ++argv;
+ }
errno = 0;
if ((name_max = pathconf(".", _PC_NAME_MAX)) == -1 &&
Home |
Main Index |
Thread Index |
Old Index