[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] Using argp_failure.
From: |
Debarshi 'Rishi' Ray |
Subject: |
Re: [bug-inetutils] Using argp_failure. |
Date: |
Sat, 14 Apr 2007 15:08:56 +0530 |
As advised by 'bing' on IRC last night, I have tried to concentrate on
a simpler program than 'ifconfig'-- ping/ping6.
I have replaced all those uses of 'fprintf (stderr, "...); exit (1);"
to handle some illegal value passed to an argument, etc. with
argp_failure to ensure uniformity in the erroring reporting. What I
have done is share the 'struct argp_state *state' between all the
files that will now contain calls to argp_failure. Since most of these
files already '#include 'ping_common.h', I have put the definition of
'struct argp_state *state' there itself.
You can try this patch on the CVS version of ping/ping6:
http://glug-nith.org/~rishi/download/src/ping-argp.diff
Happy hacking,
Debarshi
On 13/04/07, Alfred M. Szmidt <address@hidden> wrote:
> Wouldn't it be better to use argp_error in those parts? Or do
> those actually do parsing?
No. According to the manual, argp_error is for handling parsing
errors, while argp_failure is for other things like illegal values,
etc.. In any case argp_error also needs the 'struct argp_state
*state' pointer.
Hm, What about using argp children? And changing for example
changeif.c into a argp child, the same for system/*. The manual
should have some examples, and documentation.
You sure did pick one of the most complex programs to work on...
--
GPG key ID: 63D4A5A7
Key server: pgp.mit.edu