From 7e76b8b7daf9971b93191039d0a77e856733e735 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 7 Apr 1996 17:46:03 +0000 Subject: (usage): Give minimal description of the program. (print_factors): Give a better diagnostic. (main): Suggest --help upon failure. Reported by Karl Eichwalder . --- src/factor.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.3-70-g09d2