On Tuesday 18 July 2006 19:43, Matt Diephouse wrote:
> I know I'm a little late to the game here, but in the future it would
> be useful to mention this sort of info in a comment in the source. :-)
> And a comment might be a nice addition even now.
>
> (You mentioned being more clear in the svn log, but a comment would
> really be the most useful.)
Something like this?
-- c
=== compilers/imcc/main.c
==================================================================
--- compilers/imcc/main.c (revision 19177)
+++ compilers/imcc/main.c (local)
@@ -370,6 +370,15 @@
}
/* reached the end of the option list and consumed all of argv */
if (*argc == opt.opt_index ) {
+
+ /* The only flag that must take a parameter is -o, so if there is a
+ * mismatch, either that missed its required argument or there is no
+ * program to execute. Detecting -o is easy; there's an
+ * interp->output_file. (If -o appears with no argument, the getopt
+ * check would have complained earlier.)
+ *
+ * There's really no way to tell which parameter is missing. For now,
+ * this is the best error message I can imagine. -- c */
if (interp->output_file) {
fprintf(stderr, "Missing program name or argument for -o\n");
}