summaryrefslogtreecommitdiff
path: root/src/head.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-10-27 14:24:42 +0000
committerJim Meyering <jim@meyering.net>2001-10-27 14:24:42 +0000
commit58b5f108f2365f5afa9f828f5a397e162d0ea38c (patch)
tree2643dca1b8bf95d711995bb0ab1325c4aa9ffcaf /src/head.c
parent93a207af8d199e32f9971b99e7a0e398b7d0c5b6 (diff)
downloadcoreutils-58b5f108f2365f5afa9f828f5a397e162d0ea38c.tar.xz
Give an accurate diagnostic when `head --bytes=30M' fails.
(string_to_integer): Check explicitly for overflow, and lump everything else together as `invalid'.
Diffstat (limited to 'src/head.c')
-rw-r--r--src/head.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/head.c b/src/head.c
index a71a83d03..634389771 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;