summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-04-07 17:46:03 +0000
committerJim Meyering <jim@meyering.net>1996-04-07 17:46:03 +0000
commit7e76b8b7daf9971b93191039d0a77e856733e735 (patch)
tree7d2fcb424759278f62406508dafd2013da885fb9
parentd9fe3593778a5c579db7ad7f58c13781f0bb9e99 (diff)
downloadcoreutils-7e76b8b7daf9971b93191039d0a77e856733e735.tar.xz
(usage): Give minimal description of the program.
(print_factors): Give a better diagnostic. (main): Suggest --help upon failure. Reported by Karl Eichwalder <ke@ke.Central.DE>.
-rw-r--r--src/factor.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/factor.c b/src/factor.c
index a152eb8d0..db5d68cd7 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -71,6 +71,9 @@ Usage: %s [NUMBER...]\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
+\n\
+ Print the prime factors of all specified integer NUMBERs. If no arguments\n\
+ are specified on the command line, they are read from standard input.\n\
"));
}
exit (status);
@@ -133,7 +136,7 @@ print_factors (const char *s)
if (xstrtoul (s, NULL, 10, &n, NULL) != LONGINT_OK)
{
- error (0, 0, _("%s: invalid argument"), s);
+ error (0, 0, _("`%s' is not a valid positive integer"), s);
return 1;
}
n_factors = factor (n, MAX_N_FACTORS, factors);
@@ -188,6 +191,8 @@ main (int argc, char **argv)
for (i = 1; i < argc; i++)
fail |= print_factors (argv[i]);
}
+ if (fail)
+ usage (1);
exit (fail);
}