From: Jim Meyering Date: Sat, 27 Oct 2001 14:24:42 +0000 (+0000) Subject: Give an accurate diagnostic when `head --bytes=30M' fails. X-Git-Tag: FILEUTILS-4_1_1~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=58b5f108f2365f5afa9f828f5a397e162d0ea38c;p=thirdparty%2Fcoreutils.git Give an accurate diagnostic when `head --bytes=30M' fails. (string_to_integer): Check explicitly for overflow, and lump everything else together as `invalid'. --- diff --git a/src/head.c b/src/head.c index a71a83d031..634389771b 100644 --- a/src/head.c +++ b/src/head.c @@ -225,19 +225,19 @@ string_to_integer (int count_lines, const char *n_string) s_err = xstrtoumax (n_string, NULL, 10, &n, "bkm"); - if (s_err == LONGINT_INVALID) + if (s_err == LONGINT_OVERFLOW) { - error (EXIT_FAILURE, 0, "%s: %s", n_string, - (count_lines - ? _("invalid number of lines") - : _("invalid number of bytes"))); + error (EXIT_FAILURE, 0, + _("%s: %s is so large that it is not representable"), n_string, + count_lines ? _("number of lines") : _("number of bytes")); } if (s_err != LONGINT_OK) { - error (EXIT_FAILURE, 0, - _("%s: %s is so large that it is not representable"), n_string, - count_lines ? _("number of lines") : _("number of bytes")); + error (EXIT_FAILURE, 0, "%s: %s", n_string, + (count_lines + ? _("invalid number of lines") + : _("invalid number of bytes"))); } return n;