bug-inetutils
[Top][All Lists]
Advanced

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

[bug-inetutils] Command line parsing of ping with genparse


From: Michael Geng
Subject: [bug-inetutils] Command line parsing of ping with genparse
Date: Tue, 25 Dec 2007 13:09:15 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hi Alfred, hello mailing list,

regarding http://lists.gnu.org/archive/html/bug-coreutils/2007-12/msg00125.html

Attached is a patch which shows how genparse could be used for command line 
parsing of the ping command of the inetutils. If you want to know more about 
genparse, you are invited to visit

http://genparse.sourceforge.net/

The ping tool was of special interest for me because it is presently being 
converted to use argp, another command line parsing tool, which I presently
don't know very much. The main difference between argp and genparse is that
genparse generates command line parsing code at compile time while argp is
not a real tool but a set of library functions which perform the command 
line parsing at run time. Both genparse and argp are wrappers around getopt 
or getopt_long, so the core parsing code is the same for both solutions.

I added ping to the list of genparse examples at

http://genparse.sourceforge.net/examples/

>From there you can view the genparse input 

http://genparse.sourceforge.net/examples/ping.gp

and the generated parser code

http://genparse.sourceforge.net/examples/ping_clp.c and
http://genparse.sourceforge.net/examples/ping_clp.h

The argp solution for the ping command is available from

http://cvs.savannah.gnu.org/viewvc/*checkout*/inetutils/ping/ping.c?root=inetutils&revision=1.34&content-type=text%2Fplain

The attached patch is targeted to inetutils version 1.5. If you want to 
compile it on your own, you will need genparse version 0.7.4 in your path
which you can download from

http://sourceforge.net/project/showfiles.php?group_id=4341

Any comments welcome!

Michael

Attachment: inetutils-1.5-genparse-ping.patch
Description: Text Data


reply via email to

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