diff options
author | Jim Meyering <jim@meyering.net> | 1999-08-22 08:46:33 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-08-22 08:46:33 +0000 |
commit | 138cf56fdbd145ad878290b4511414b68199ff0d (patch) | |
tree | 8ef1f0ed4b7f5370679f31d10b427c62811a313c | |
parent | a711e8e1324bac94b850568dc5005aa2b51dbada (diff) | |
download | coreutils-138cf56fdbd145ad878290b4511414b68199ff0d.tar.xz |
(parse_integer): Add `const' to char* parameter and
add a separate `suffix' variable.
-rw-r--r-- | src/dd.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -462,7 +462,8 @@ write_output (void) oc = 0; } -/* Interpret one "conv=..." option. */ +/* Interpret one "conv=..." option. + As a by product, this function replaces each `,' in STR with a NUL byte. */ static void parse_conversion (char *str) @@ -496,14 +497,15 @@ parse_conversion (char *str) this format. */ static uintmax_t -parse_integer (char *str, int *invalid) +parse_integer (const char *str, int *invalid) { uintmax_t n; - enum strtol_error e = xstrtoumax (str, &str, 10, &n, "bcEGkMPTwYZ0"); + char *suffix; + enum strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEGkMPTwYZ0"); - if (e == LONGINT_INVALID_SUFFIX_CHAR && *str == 'x') + if (e == LONGINT_INVALID_SUFFIX_CHAR && *suffix == 'x') { - uintmax_t multiplier = parse_integer (str + 1, invalid); + uintmax_t multiplier = parse_integer (suffix + 1, invalid); if (multiplier != 0 && n * multiplier / multiplier != n) { |