changeset 289:a1fdf34d9504

Fluffier error message.
author Rob Landley <rob@landley.net>
date Sun, 04 May 2008 18:52:29 -0500
parents e75dac368375
children d37e2de3a9f3
files lib/args.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lib/args.c	Sun May 04 16:20:15 2008 -0500
+++ b/lib/args.c	Sun May 04 18:52:29 2008 -0500
@@ -152,6 +152,7 @@
 	struct getoptflagstate gof;
 	long *nextarg = (long *)&this;
 	char *options = toys.which->options;
+	char *letters[]={"s",""};
 
 	if (CFG_HELP) toys.exithelp++;
 	// Allocate memory for optargs
@@ -332,9 +333,11 @@
 	}
 
 	// Sanity check
-	if (toys.optc<minargs)
-		error_exit("Need %d argument%s", minargs, minargs ? "s" : "");
+	if (toys.optc<minargs) {
+		error_exit("Need%s %d argument%s", letters[!!(minargs-1)], minargs,
+		letters[!(minargs-1)]);
+	}
 	if (toys.optc>maxargs)
-		error_exit("Max %d argument%s", maxargs, maxargs ? "s" : "");
+		error_exit("Max %d argument%s", maxargs, letters[!(maxargs-1)]);
 	if (CFG_HELP) toys.exithelp = 0;
 }