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 mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-inetutils