summaryrefslogtreecommitdiff
path: root/usr.bin/split
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1994-04-06 00:04:09 +0000
committercgd <cgd@NetBSD.org>1994-04-06 00:04:09 +0000
commite104a4a2bc9b5b22df9b708f38eb18eb92d1350c (patch)
tree2fa2ace93905093e46ae0cbcfd8455c463ad5ef6 /usr.bin/split
parent4b24a3521e9edef2f891ac0746416109899dbd90 (diff)
don't core if -b is given no argument. bug pointed out by nate williams,
fix by me.
Diffstat (limited to 'usr.bin/split')
-rw-r--r--usr.bin/split/split.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 912cad3b83f..2e9bf21b550 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)split.c 4.8 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: split.c,v 1.2 1993/08/01 18:08:21 mycroft Exp $";
+static char rcsid[] = "$Id: split.c,v 1.3 1994/04/06 00:04:09 cgd Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -80,9 +80,11 @@ main(argc, argv)
case 'b': /* byte count split */
if (numlines)
usage();
- if (!argv[cnt][2])
- bytecnt = atol(argv[++cnt]);
- else
+ if (!argv[cnt][2]) {
+ if (++cnt >= argc)
+ usage();
+ bytecnt = atol(argv[cnt]);
+ } else
bytecnt = atol(argv[cnt] + 2);
if (bytecnt <= 0) {
fputs("split: byte count must be greater than zero.\n", stderr);