void mrp_parse_cmdline(mrp_context_t *ctx, int argc, char **argv)
{
- #define OPTIONS "c:C:l:t:fP:a:vd:Dhq"
+# define OPTIONS "c:C:l:t:fP:a:vd:DhHq"
struct option options[] = {
{ "config-file" , required_argument, NULL, 'c' },
{ "config-dir" , required_argument, NULL, 'C' },
{ "list-debug" , no_argument , NULL, 'D' },
{ "foreground" , no_argument , NULL, 'f' },
{ "help" , no_argument , NULL, 'h' },
+ { "more-help" , no_argument , NULL, 'H' },
{ "query-plugins", no_argument , NULL, 'q' },
{ NULL, 0, NULL, 0 }
};
- int opt;
+ int opt, help;
config_set_defaults(ctx);
mrp_log_set_mask(ctx->log_mask);
mrp_log_set_target(ctx->log_target);
+ help = FALSE;
+
while ((opt = getopt_long(argc, argv, OPTIONS, options, NULL)) != -1) {
switch (opt) {
case 'c':
break;
case 'h':
- print_usage(argv[0], -1, "");
- print_plugin_help(ctx, FALSE);
- exit(0);
+ help++;
+ break;
+
+ case 'H':
+ help += 2;
break;
case 'q':
print_usage(argv[0], EINVAL, "invalid option '%c'", opt);
}
}
+
+ if (help) {
+ print_usage(argv[0], -1, "");
+ if (help > 1)
+ print_plugin_help(ctx, FALSE);
+ exit(0);
+ }
+
}