From 1ce7b61d0ea270b0c463198afca1cd0e214192fb Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 21 Jun 2004 15:03:35 +0000 Subject: (main): Standardize on the diagnostics given when someone gives too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included. --- src/comm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/comm.c') diff --git a/src/comm.c b/src/comm.c index e7acf3393..c854b8c70 100644 --- a/src/comm.c +++ b/src/comm.c @@ -26,6 +26,7 @@ #include "linebuffer.h" #include "error.h" #include "hard-locale.h" +#include "quote.h" #include "xmemcoll.h" /* The official name of this program (e.g., no `g' prefix). */ @@ -283,9 +284,18 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (optind + 2 != argc) + if (argc - optind < 2) { - error (0, 0, _("too few arguments")); + if (argc <= optind) + error (0, 0, _("missing operand")); + else + error (0, 0, _("missing operand after %s"), quote (argv[argc - 1])); + usage (EXIT_FAILURE); + } + + if (2 < argc - optind) + { + error (0, 0, _("extra operand %s"), quote (argv[optind + 2])); usage (EXIT_FAILURE); } -- cgit v1.2.3-54-g00ecf