bug-coreutils
[Top][All Lists]
Advanced

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

Re: Command line parsing with genparse


From: Alfred M. Szmidt
Subject: Re: Command line parsing with genparse
Date: Wed, 19 Dec 2007 18:11:25 +0100 (CET)

   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.

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/.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]