Re: [PATCH 5/7] parse-opt: fake short strings for callers to believe in.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pierre Habouzit wrote:
On Tue, Jun 24, 2008 at 05:20:28PM +0000, Linus Torvalds wrote:

On Tue, 24 Jun 2008, Pierre Habouzit wrote:
If we begin to parse -abc and that the parser knew about -a and -b, it
will fake a -c switch for the caller to deal with.

Of course in the case of -acb (supposing -c is not taking an argument) the
caller will have to be especially clever to do the same thing. We could
think about exposing an API to do so if it's really needed, but oh well...
Well, if the other parser is _also_ parse_options() (ie you just cascade them incrementally in a loop), then the other parser should get it right automatically. No?

  Exactly. There are minor glitches wrt the help generation to deal
with, but for pure parsing issues yes, it will work.


Why not just provide some api-functions to return a strbuf of the short
and long options each?

parse_opt_short_help(strbuf *sb, options...);
parse_opt_long_help(strbuf *sb_long, options...);

That way multi-parseopt programs can get their help-texts done right
with very little extra work.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux