[Libguestfs] [PATCH libguestfs 2/5] guestfish: write --help to stdout, use gnulib's progname module

Richard W.M. Jones rjones at redhat.com
Mon Aug 24 11:30:30 UTC 2009


On Mon, Aug 24, 2009 at 01:21:39PM +0200, Jim Meyering wrote:
> Also, it is good policy, IMHO, to make it so a program works the same
> way no matter where the actual binary happens to be located in a file
> system hierarchy.

Well, if you can think of a better way to do it ...  I can't.

> >> +  enum { HELP_OPTION = CHAR_MAX + 1 };
> >> +
> >>    static const char *options = "a:Df:h::im:nrv?Vx";
> >>    static const struct option long_options[] = {
> >>      { "add", 1, 0, 'a' },
> >>      { "cmd-help", 2, 0, 'h' },
> >>      { "file", 1, 0, 'f' },
> >> -    { "help", 0, 0, '?' },
> >> +    { "help", 0, 0, HELP_OPTION },
> >
> > I'm unclear on why we do this - what's wrong with using '?'?
> 
> So that we can distinguish getop-diagnosed failure
> (where it returns '?') from --help.

Right, I see.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 75 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list