Refactor how options are handled

This commit is contained in:
A. Wilcox 2020-08-17 14:59:19 -05:00
parent 1a11bb768f
commit 327e738a55
No known key found for this signature in database
GPG key ID: CB29CB51922B9D14
6 changed files with 112 additions and 98 deletions

View file

@ -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);
}
}