EX_USAGE? felix (13 Jun 2001 19:40 UTC)
(missing)
(missing)
(missing)
(missing)
(missing)
Re: EX_USAGE? Marc Feeley (15 Jun 2001 13:57 UTC)
Re: EX_USAGE? sperber@xxxxxx (15 Jun 2001 16:43 UTC)
Re: EX_USAGE? David Rush (15 Jun 2001 17:23 UTC)

EX_USAGE? felix 13 Jun 2001 19:29 UTC

I have some trouble with the fact that an error in the invocation of
"main" is supposed to return EX_USAGE. Specifically
I have trouble thinking about a way to implement it in
a not too arcane way.
(If there is an obvious solution, then please feel free to
ignore this message)

1) Hooking into the error-mechanism isn't the problem,
  but after entry into "main", when user code is running,
  I can't think of a way to unhook the error handler again
  (We want a "meaningful" usage-related error message
  in the call to "main", but normal argc-error behaviour
  in case another procedure is called with the wrong number
  of arguments, right?)

2) Doing some fiddling with backtraces after the error
  situation doesn't look that good either, especially in
  the case of compiled scripts, which might not have
  much debugging info.

3) Normally I wouldn't ask about implementation-specific things
  like this. As I said: There might be a simple solution, and I'm just too
  stupid too see it, but:
  Is it really so helpful to have a distinct exit-code
  in this case? Don't have many scripts a variable number of
  arguments, anyway?

cheers,
felix