On Wed, Dec 19, 2007 at 06:11:25PM +0100, Alfred M. Szmidt wrote:
> 1. It does a significant part of the work at compile time. So the
> generated code can be quite simple and fast.
>
> I cannot comment which is simpler, since I do not know genparse. But
> parsing arguments isn't a speed critical task. argp is a wrapper
> around getopt and getopt_long, and uses those functions to parse
> arguments.
The genparse also is a wrapper around getopt_long. For argp the user
provides a customized struct and a library function does the parsing
at run time while genparse generates a customized wrapper from a
setup file at compile time.
> argp part of the GNU C Library which is used by all GNU system
> variants, like GNU/Linux, so it is a standard tool.
>
> 2. It is able to auto generate a highly configurable usage
> function. Many of the replies on my previous posts to the
> coreutils mailing list were about the usage function. argp also
> can print a usage function but how far can you customize it?
>
> You can customize as much as you would like. Please see argp chapter
> in the GNU C Library manual for details.
>
> Has anybody tried to convert one of the coreutils tools to use
> argp? I would be very interested to see a comparison to the
> genparse solution.
>
> Debarshi Ray <address@hidden> converted a bunch of tools in inetutils
> (http://www.gnu.org/s/inetutils/, http://sv.gnu.org/p/inetutils/) to
> use argp instead of getopt/getopt_long. Some which have quite hairy
> parsing semantics, for example ping which uses children parsers, but
> that patch is not in CVS yet.
>
> The Hurd also uses argp for some very weird parsing, you can look at
> examples at http://sv.gnu.org/p/hurd/.
I just downloaded the inetutils, version 1.5 but I can't find any argp
code. I looked at ping and ftp. Do I need the latest version from git?
Michael