return 0;
}
+static void print_help(const char *name)
+{
+ printf("Usage: %s [OPTIONS]\n"
+ "Options: \n"
+ " --log-level <level> Set log level to <level>\n"
+ " -D Set log level to debug\n"
+ " -d, --disable-module <module> Disable <module>\n"
+ " --no-action Do not execute any action\n"
+ " -c, --config-file <file> Read faultd configuration from <file>\n"
+ " -h, --help Display this help and exit\n", name);
+}
+
static int parse_argv(int ac, char *av[])
{
int c, r;
{"disable-module", required_argument, NULL, 'd'},
{"no-action", no_argument, NULL, ARG_NO_ACTION},
{"config-file", required_argument, NULL, 'c'},
+ {"help", no_argument, NULL, 'h'},
{}
};
const char *config_file = FAULTD_DEFAULT_CONFIG_FILE;
bool using_default_config = 1;
- while ((c = getopt_long(ac, av, "Dc:d:", options, NULL)) >= 0) {
+ while ((c = getopt_long(ac, av, "Dc:d:h", options, NULL)) >= 0) {
switch (c) {
case ARG_LOG_LEVEL:
break;
+ case 'h':
+ print_help(av[0]);
+ exit(0);
case 'd':
module = faultd_get_module_by_name(optarg);
if (module) {
break;
default:
+ print_help(av[0]);
return -EINVAL;
}
}