merge with 1.10t
authorJim Meyering <jim@meyering.net>
Fri, 21 Oct 1994 05:25:03 +0000 (05:25 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 21 Oct 1994 05:25:03 +0000 (05:25 +0000)
old/sh-utils/ChangeLog
src/basename.c
src/dirname.c
src/expr.c
src/pathchk.c
src/sleep.c

index 7739a4e..1b48189 100644 (file)
@@ -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
index 1c8a058..9270372 100644 (file)
@@ -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]);
 
index 3fb5c1a..7a0c834 100644 (file)
@@ -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);
index e1ee8e7..a30ffb7 100644 (file)
@@ -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 ();
index de8bc6c..a34df09 100644 (file)
@@ -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);
index f584f5c..a070d42 100644 (file)
@@ -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++)