diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2007-05-03 13:45:26 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-05-03 13:45:26 +0200 |
commit | 2539b53760dd4efad304e6f5f5e0880b4510d378 (patch) | |
tree | 409fd46b349d143c65076800a1db5351816c079c /src/head.c | |
parent | 4e89cf8fb8ccf01ee1d5c351d9fa327a3735007f (diff) | |
download | coreutils-2539b53760dd4efad304e6f5f5e0880b4510d378.tar.xz |
The following commands and options now support the standard size
suffixes kB, M, MB, G, GB, and so on for T, P, Y, Z, and Y:
head -c, head -n, od -j, od -N, od -S, split -b, split -C,
tail -c, tail -n.
* doc/coreutils.texi (od invocation, head invocation, tail invocation):
Document support for new size suffixes.
(head invocation, tail invocation):
Document that -n uses the same suffixes as -c.
(tail invocation): More-clearly document what leading "+" does.
* src/head.c (usage, string_to_integer): Support new suffixes.
* src/od.c (usage, main): Likewise.
* src/split.c (usage, main): Likewise.
* src/tail.c (usage, parse_options): Likewise.
Prompted by a patch from Evan Hunt.
Diffstat (limited to 'src/head.c')
-rw-r--r-- | src/head.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/head.c b/src/head.c index 9d830644c..0e4fe6cea 100644 --- a/src/head.c +++ b/src/head.c @@ -135,7 +135,9 @@ Mandatory arguments to long options are mandatory for short options too.\n\ fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\ \n\ -N may have a multiplier suffix: b 512, k 1024, m 1024*1024.\n\ +N may have a multiplier suffix:\n\ +b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,\n\ +GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.\n\ "), stdout); emit_bug_reporting_address (); } @@ -860,8 +862,8 @@ head_file (const char *filename, uintmax_t n_units, bool count_lines, return ok; } -/* Convert a string of decimal digits, N_STRING, with a single, optional suffix - character (b, k, or m) to an integral value. Upon successful conversion, +/* Convert a string of decimal digits, N_STRING, with an optional suffinx + to an integral value. Upon successful conversion, return that value. If it cannot be converted, give a diagnostic and exit. COUNT_LINES indicates whether N_STRING is a number of bytes or a number of lines. It is used solely to give a more specific diagnostic. */ @@ -872,7 +874,7 @@ string_to_integer (bool count_lines, const char *n_string) strtol_error s_err; uintmax_t n; - s_err = xstrtoumax (n_string, NULL, 10, &n, "bkm"); + s_err = xstrtoumax (n_string, NULL, 10, &n, "bkKmMGTPEZY0"); if (s_err == LONGINT_OVERFLOW) { |