summaryrefslogtreecommitdiff
path: root/src/od.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-05-03 13:45:26 +0200
committerJim Meyering <jim@meyering.net>2007-05-03 13:45:26 +0200
commit2539b53760dd4efad304e6f5f5e0880b4510d378 (patch)
tree409fd46b349d143c65076800a1db5351816c079c /src/od.c
parent4e89cf8fb8ccf01ee1d5c351d9fa327a3735007f (diff)
downloadcoreutils-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/od.c')
-rw-r--r--src/od.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/od.c b/src/od.c
index 1ae783420..c5eefe18c 100644
--- a/src/od.c
+++ b/src/od.c
@@ -383,10 +383,11 @@ for sizeof(double) or L for sizeof(long double).\n\
fputs (_("\
\n\
RADIX is d for decimal, o for octal, x for hexadecimal or n for none.\n\
-BYTES is hexadecimal with 0x or 0X prefix, it is multiplied by 512\n\
-with b suffix, by 1024 with k and by 1048576 with m. Adding a z suffix to\n\
-any type adds a display of printable characters to the end of each line\n\
-of output. \
+BYTES is hexadecimal with 0x or 0X prefix, and 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\
+Adding a z suffix to any type displays printable characters at the end of each\n\
+output line. \
"), stdout);
fputs (_("\
--string without a number implies 3. --width without a number\n\
@@ -1563,6 +1564,7 @@ main (int argc, char **argv)
bool modern = false;
bool width_specified = false;
bool ok = true;
+ static char const multipliers[] = "bEGKkMmPTYZ0";
/* The old-style `pseudo starting address' to be printed in parentheses
after any true address. */
@@ -1650,7 +1652,7 @@ it must be one character from [doxn]"),
case 'j':
modern = true;
- s_err = xstrtoumax (optarg, NULL, 0, &n_bytes_to_skip, "bkm");
+ s_err = xstrtoumax (optarg, NULL, 0, &n_bytes_to_skip, multipliers);
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (optarg, _("skip argument"), s_err);
break;
@@ -1659,7 +1661,8 @@ it must be one character from [doxn]"),
modern = true;
limit_bytes_to_format = true;
- s_err = xstrtoumax (optarg, NULL, 0, &max_bytes_to_format, "bkm");
+ s_err = xstrtoumax (optarg, NULL, 0, &max_bytes_to_format,
+ multipliers);
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (optarg, _("limit argument"), s_err);
break;
@@ -1670,7 +1673,7 @@ it must be one character from [doxn]"),
string_min = 3;
else
{
- s_err = xstrtoumax (optarg, NULL, 0, &tmp, "bkm");
+ s_err = xstrtoumax (optarg, NULL, 0, &tmp, multipliers);
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (optarg, _("minimum string length"), s_err);