aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/split/split.c
diff options
context:
space:
mode:
authorGiorgos Keramidas <keramida@FreeBSD.org>2006-08-10 10:41:47 +0000
committerGiorgos Keramidas <keramida@FreeBSD.org>2006-08-10 10:41:47 +0000
commita6dd1c93f49cf4b8e1d7ed6ed4100aef37d0ceab (patch)
treee9178db3548ea9d43dd71ffd1b7cff64a03b3dfa /usr.bin/split/split.c
parent04d9e255dfea0a3bf86eeb984dd940d7705df670 (diff)
Notes
Diffstat (limited to 'usr.bin/split/split.c')
-rw-r--r--usr.bin/split/split.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 71b47c739978..d7936b0b88dd 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -116,14 +116,15 @@ main(int argc, char **argv)
case 'b': /* Byte count. */
errno = 0;
if ((bytecnti = strtoimax(optarg, &ep, 10)) <= 0 ||
- (*ep != '\0' && *ep != 'k' && *ep != 'm') ||
- errno != 0)
+ strchr("kKmMgG", *ep) == NULL || errno != 0)
errx(EX_USAGE,
"%s: illegal byte count", optarg);
- if (*ep == 'k')
+ if (*ep == 'k' || *ep == 'K')
scale = 1024;
- else if (*ep == 'm')
+ else if (*ep == 'm' || *ep == 'M')
scale = 1024 * 1024;
+ else if (*ep == 'g' || *ep == 'G')
+ scale = 1024 * 1024 * 1024;
else
scale = 1;
if (bytecnti > OFF_MAX / scale)
@@ -336,7 +337,7 @@ usage(void)
{
(void)fprintf(stderr,
"usage: split [-l line_count] [-a suffix_length] [file [prefix]]\n"
-" split -b byte_count[k|m] [-a suffix_length] [file [prefix]]\n"
+" split -b byte_count[K|k|M|m|G|g] [-a suffix_length] [file [prefix]]\n"
" split -p pattern [-a suffix_length] [file [prefix]]\n");
exit(EX_USAGE);
}