summaryrefslogtreecommitdiff
path: root/usr.bin/split
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1997-10-19 23:26:56 +0000
committerlukem <lukem@NetBSD.org>1997-10-19 23:26:56 +0000
commit9ea1c85731be40538e1bebd80af0b3f746a477cb (patch)
treeafe32b01b9248a9f80011076fdb5a5ef065ce95d /usr.bin/split
parent8976f09712d6fa9965910879f517980d4440a836 (diff)
WARNSify, fix .Nm usage, getopt returns -1 not EOF
Diffstat (limited to 'usr.bin/split')
-rw-r--r--usr.bin/split/split.110
-rw-r--r--usr.bin/split/split.c15
2 files changed, 13 insertions, 12 deletions
diff --git a/usr.bin/split/split.1 b/usr.bin/split/split.1
index 788f1007b93..50fe967b421 100644
--- a/usr.bin/split/split.1
+++ b/usr.bin/split/split.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: split.1,v 1.5 1994/12/21 08:20:35 jtc Exp $
+.\" $NetBSD: split.1,v 1.6 1997/10/19 23:26:56 lukem Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -40,13 +40,13 @@
.Nm split
.Nd split a file into pieces
.Sh SYNOPSIS
-.Nm split
+.Nm
.Op Fl b Ar byte_count[k|m]
.Op Fl l Ar line_count
.Op Ar file Op Ar name
.Sh DESCRIPTION
The
-.Nm split
+.Nm
utility reads the given
.Ar file
(or standard input if no file is specified)
@@ -90,12 +90,12 @@ files named in the range of
.Sh BUGS
For historical reasons, if you specify
.Ar name ,
-.Nm split
+.Nm
can only create 676 separate
files.
The default naming convention allows 2028 separate files.
.Sh HISTORY
A
-.Nm split
+.Nm
command appeared in
.At v6 .
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index ab981252cbc..7da56128d66 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -1,4 +1,4 @@
-/* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */
+/* $NetBSD: split.c,v 1.6 1997/10/19 23:26:58 lukem Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1987, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)split.c 8.3 (Berkeley) 4/25/94";
#endif
-static char rcsid[] = "$NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $";
+__RCSID("$NetBSD: split.c,v 1.6 1997/10/19 23:26:58 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -65,6 +65,7 @@ int ifd = -1, ofd = -1; /* Input/output file descriptors. */
char bfr[MAXBSIZE]; /* I/O buffer. */
char fname[MAXPATHLEN]; /* File name prefix. */
+int main __P((int, char **));
void newfile __P((void));
void split1 __P((void));
void split2 __P((void));
@@ -78,7 +79,7 @@ main(argc, argv)
int ch;
char *ep, *p;
- while ((ch = getopt(argc, argv, "-0123456789b:l:")) != EOF)
+ while ((ch = getopt(argc, argv, "-0123456789b:l:")) != -1)
switch (ch) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
@@ -105,7 +106,7 @@ main(argc, argv)
break;
case 'b': /* Byte count. */
if ((bytecnt = strtol(optarg, &ep, 10)) <= 0 ||
- *ep != '\0' && *ep != 'k' && *ep != 'm')
+ (*ep != '\0' && *ep != 'k' && *ep != 'm'))
errx(1, "%s: illegal byte count.", optarg);
if (*ep == 'k')
bytecnt *= 1024;