[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] Argpifying ifconfig.
From: |
Debarshi 'Rishi' Ray |
Subject: |
Re: [bug-inetutils] Argpifying ifconfig. |
Date: |
Wed, 4 Apr 2007 22:24:27 +0530 |
Since I do not need 'index' in main (), I want to get rid of it.
Then how do you plan to handle traditional ifconfig invocation?
As far as I understand, the traditional ifconfig invocation was being
handled by this snippet of code after the while loop involving getopt
was over:
parse_opt_finalize (ifp);
if (state->next < state->argc)
{
if (!system_parse_opt_rest (&ifp, state->argc - state->next,
&state->argv[state->next]))
exit (EXIT_FAILURE);
parse_opt_finalize (ifp);
}
Now that we are using argp, I think we have to modify
system_parse_opt_rest so that it works with one non-option (tradional)
argument at a time, instead of expecting the whole array of unparsed
arguments.
Putting this modified system_parse_opt_rest within a 'case
ARGP_KEY_ARG' should handle the traditional invocation properly.
Since the replacement of getopt with argp, we have to replace
functions like 'usage (int err)' with 'argp (struct argp_state*)'.
Since many of the parse_opt_* functions would be calling argp_usage,
having a global 'struct argp_state' might be helpful. This would also
remove the use of 'char *program_name', since 'state->name' would do
the same job.
What do you think?
Happy hacking,
Debarshi
--
GPG key ID: 63D4A5A7
Key server: pgp.mit.edu
- [bug-inetutils] Argpifying ifconfig., Debarshi 'Rishi' Ray, 2007/04/02
- Re: [bug-inetutils] Argpifying ifconfig., Alfred M. Szmidt, 2007/04/02
- Re: [bug-inetutils] Argpifying ifconfig., Sergey Poznyakoff, 2007/04/03
- Re: [bug-inetutils] Argpifying ifconfig.,
Debarshi 'Rishi' Ray <=
- Re: [bug-inetutils] Argpifying ifconfig., Sergey Poznyakoff, 2007/04/04
- Re: [bug-inetutils] Argpifying ifconfig., Alfred M. Szmidt, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Sergey Poznyakoff, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Alfred M. Szmidt, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Debarshi 'Rishi' Ray, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Alfred M. Szmidt, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Debarshi 'Rishi' Ray, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Debarshi 'Rishi' Ray, 2007/04/05
- Re: [bug-inetutils] Argpifying ifconfig., Alfred M. Szmidt, 2007/04/07
- Re: [bug-inetutils] Argpifying ifconfig., Sergey Poznyakoff, 2007/04/08