diff options
author | Jim Meyering <jim@meyering.net> | 1994-10-21 05:25:03 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-10-21 05:25:03 +0000 |
commit | b902a4439eff117f8eee8cc01a2472646d76613d (patch) | |
tree | 7d327471d12a0e45f366ed1e62ff5add6802c5ae | |
parent | aa3d6d01e8844e20fc08f5bb9b2115c7967ba434 (diff) | |
download | coreutils-b902a4439eff117f8eee8cc01a2472646d76613d.tar.xz |
merge with 1.10t
-rw-r--r-- | old/sh-utils/ChangeLog | 6 | ||||
-rw-r--r-- | src/basename.c | 6 | ||||
-rw-r--r-- | src/dirname.c | 6 | ||||
-rw-r--r-- | src/expr.c | 6 | ||||
-rw-r--r-- | src/pathchk.c | 5 | ||||
-rw-r--r-- | src/sleep.c | 4 |
6 files changed, 27 insertions, 6 deletions
diff --git a/old/sh-utils/ChangeLog b/old/sh-utils/ChangeLog index 7739a4e2b..1b48189ba 100644 --- a/old/sh-utils/ChangeLog +++ b/old/sh-utils/ChangeLog @@ -1,3 +1,9 @@ +Fri Oct 21 00:57:23 1994 Jim Meyering (meyering@comco.com) + + * basename.c, dirname.c, expr.c, pathchk.c, sleep.c (main): Diagnose + wrong number of argument -- usually too few -- instead of just + referring the user to the --help option. Reported by Karl Berry. + Mon Oct 17 23:55:41 1994 Jim Meyering (meyering@comco.com) * doc/Makefile.in (install): Install the info files from either diff --git a/src/basename.c b/src/basename.c index 1c8a058e2..9270372bd 100644 --- a/src/basename.c +++ b/src/basename.c @@ -34,6 +34,7 @@ #include "long-options.h" char *basename (); +void error (); void strip_trailing_slashes (); static void remove_suffix (); @@ -76,7 +77,10 @@ main (argc, argv) parse_long_options (argc, argv, "basename", version_string, usage); if (argc == 1 || argc > 3) - usage (1); + { + error (0, 0, "too %s arguments", argc == 1 ? "few" : "many"); + usage (1); + } strip_trailing_slashes (argv[1]); diff --git a/src/dirname.c b/src/dirname.c index 3fb5c1a4a..7a0c834ea 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -25,6 +25,7 @@ #include "version.h" #include "long-options.h" +void error (); void strip_trailing_slashes (); /* The name this program was run with. */ @@ -66,7 +67,10 @@ main (argc, argv) parse_long_options (argc, argv, "dirname", version_string, usage); if (argc != 2) - usage (1); + { + error (0, 0, "too %s arguments", argc < 2 ? "few" : "many"); + usage (1); + } path = argv[1]; strip_trailing_slashes (path); diff --git a/src/expr.c b/src/expr.c index e1ee8e722..a30ffb7a9 100644 --- a/src/expr.c +++ b/src/expr.c @@ -162,7 +162,11 @@ main (argc, argv) parse_long_options (argc, argv, "expr", version_string, usage); if (argc == 1) - usage (1); + { + error (0, 0, "too few arguments"); + usage (1); + } + args = argv + 1; v = eval (); diff --git a/src/pathchk.c b/src/pathchk.c index de8bc6c3f..a34df0929 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -151,7 +151,10 @@ main (argc, argv) usage (0); if (optind == argc) - usage (1); + { + error (0, 0, "too few arguments"); + usage (1); + } for (; optind < argc; ++optind) exit_status |= validate_path (argv[optind], check_portability); diff --git a/src/sleep.c b/src/sleep.c index f584f5cad..a070d42ca 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -98,8 +98,8 @@ main (argc, argv) if (argc == 1) { - fprintf (stderr, "Usage: %s number[smhd]...\n", argv[0]); - exit (1); + error (0, 0, "too few arguments"); + usage (1); } for (i = 1; i < argc; i++) |