[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improved Bison diagnostic for too few or too many operands
From: |
Paul Eggert |
Subject: |
improved Bison diagnostic for too few or too many operands |
Date: |
Mon, 21 Oct 2002 22:15:20 -0700 (PDT) |
2002-10-21 Paul Eggert <address@hidden>
* src/getargs.c (getargs): When there are too few operands, report
the last one. When there are too many, report the first extra
one. This is how diffutils does it.
Index: getargs.c
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -p -u -r1.43 -r1.44
--- getargs.c 19 Oct 2002 14:36:40 -0000 1.43
+++ getargs.c 21 Oct 2002 18:15:13 -0000 1.44
@@ -1,5 +1,5 @@
/* Parse command line arguments for bison.
- Copyright 1984, 1986, 1989, 1992, 2000, 2001, 2002
+ Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -410,11 +410,12 @@ getargs (int argc, char *argv[])
exit (1);
}
- if (optind != argc - 1)
+ if (argc - optind != 1)
{
- error (0, 0,
- (optind == argc
- ? _("too few arguments") : _("too many arguments")));
+ if (argc - optind < 1)
+ error (0, 0, _("missing operand after `%s'"), argv[argc - 1]);
+ else
+ error (0, 0, _("extra operand `%s'"), argv[optind + 1]);
usage (EXIT_FAILURE);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- improved Bison diagnostic for too few or too many operands,
Paul Eggert <=