bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: larger output file sizes for 'split'


From: Evan Hunt
Subject: PATCH: larger output file sizes for 'split'
Date: Tue, 1 May 2007 19:05:11 -0700
User-agent: Mutt/1.5.10i

Here's a one-line patch to split.c (plus a few more lines of doc changes
in that file and coreutils.texi) to allow it to emit output files sized in
gigabytes, terabytes, etc.

(Not that I expect a lot of people to use the terabytes and petabtes and so
forth, but they'll be useful someday, and gigabytes are definitely useful
now.)

Evan Hunt

-------
diff -u doc/coreutils.texi.01 doc/coreutils.texi
--- doc/coreutils.texi.01   2007-05-01 18:46:49.000000000 -0700
+++ doc/coreutils.texi      2007-05-01 18:49:48.000000000 -0700
@@ -2749,9 +2749,10 @@
 @itemx address@hidden
 @opindex -b
 @opindex --bytes
-Put the first @var{bytes} bytes of @var{input} into each output file.
-Appending @samp{b} multiplies @var{bytes} by 512, @samp{k} by 1024, and
address@hidden by 1048576.
+Put @var{bytes} bytes of @var{input} into each output file.
+Appending @samp{b} multiplies @var{bytes} by 512, @samp{k} or @samp{K} 
+multiplies by 1024, @samp{m} or @samp{M} multiplies by 1048576, and
+so on for G, T, P, E, Z, Y.\n\
 
 @item -C @var{bytes}
 @itemx address@hidden

diff -u src/split.c.00 src/split.c
--- src/split.c.00      2007-05-01 18:15:52.000000000 -0700
+++ src/split.c 2007-05-01 18:46:23.000000000 -0700
@@ -131,7 +131,9 @@
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
       fputs (_("\
 \n\
-SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\
+SIZE may have a multiplier suffix: \n\
+  b for 512, k or K for 1024 (default), m or M for 1048576,\n\
+  and so on for G, T, P, E, Z, Y.\n\
 "), stdout);
       printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
     }
@@ -428,7 +430,8 @@
          if (split_type != type_undef)
            FAIL_ONLY_ONE_WAY ();
          split_type = type_bytes;
-         if (xstrtoumax (optarg, NULL, 10, &n_units, "bkm") != LONGINT_OK
+         if (xstrtoumax (optarg, NULL, 10, &n_units, "bEgGkKmMPtTYZ")
+                          != LONGINT_OK
              || n_units == 0)
            {
              error (0, 0, _("%s: invalid number of bytes"), optarg);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]