Refactor how options are handled
This commit is contained in:
parent
1a11bb768f
commit
327e738a55
6 changed files with 112 additions and 98 deletions
|
|
@ -21,6 +21,8 @@
|
|||
#include <getopt.h>
|
||||
#include "cmd/multicall.h"
|
||||
|
||||
extern const struct if_applet *self_applet;
|
||||
|
||||
void
|
||||
generic_usage(const struct if_applet *applet, int result)
|
||||
{
|
||||
|
|
@ -66,13 +68,11 @@ generic_usage(const struct if_applet *applet, int result)
|
|||
}
|
||||
|
||||
static void
|
||||
generic_usage_request(int short_opt, const struct if_option *option, const char *opt_arg, const struct if_applet *applet)
|
||||
generic_usage_request(const char *opt_arg)
|
||||
{
|
||||
(void) short_opt;
|
||||
(void) option;
|
||||
(void) opt_arg;
|
||||
|
||||
generic_usage(applet, EXIT_SUCCESS);
|
||||
generic_usage(self_applet, EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static struct if_option global_options[] = {
|
||||
|
|
@ -154,6 +154,6 @@ process_options(const struct if_applet *applet, int argc, char *argv[])
|
|||
if (opt == NULL)
|
||||
break;
|
||||
|
||||
opt->handle(c, opt, optarg, applet);
|
||||
opt->handle(optarg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue