From e2959275b628151f64ce89ee2f5a36fa20c9778b Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 18 Aug 2020 14:12:34 -0600 Subject: [PATCH 1/2] multicall: add ability for applets to specify a manpage reference --- cmd/multicall-options.c | 3 +++ cmd/multicall.h | 1 + 2 files changed, 4 insertions(+) diff --git a/cmd/multicall-options.c b/cmd/multicall-options.c index 9037264..0c7597a 100644 --- a/cmd/multicall-options.c +++ b/cmd/multicall-options.c @@ -62,6 +62,9 @@ generic_usage(const struct if_applet *applet, int result) } } + if (applet->manpage != NULL) + fprintf(stderr, "\nFor more information: man %s\n", applet->manpage); + exit(result); } diff --git a/cmd/multicall.h b/cmd/multicall.h index 23cb836..0843580 100644 --- a/cmd/multicall.h +++ b/cmd/multicall.h @@ -43,6 +43,7 @@ struct if_applet { const char *name; const char *desc; const char *usage; + const char *manpage; int (*const main)(int argc, char *argv[]); const struct if_option_group *groups[16]; }; From 520b831bdf8f7a510be6853e242c8dbb173f53f3 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 18 Aug 2020 14:14:33 -0600 Subject: [PATCH 2/2] cmd: add manpage xrefs where we have manpages already --- cmd/ifquery.c | 1 + cmd/ifupdown.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmd/ifquery.c b/cmd/ifquery.c index 0612823..9bc0b9d 100644 --- a/cmd/ifquery.c +++ b/cmd/ifquery.c @@ -329,5 +329,6 @@ struct if_applet ifquery_applet = { .desc = "query interface configuration", .main = ifquery_main, .usage = "ifquery [options] \n ifquery [options] --list", + .manpage = "8 ifquery", .groups = { &global_option_group, &match_option_group, &exec_option_group, &local_option_group }, }; diff --git a/cmd/ifupdown.c b/cmd/ifupdown.c index c1bce3a..0fa7e29 100644 --- a/cmd/ifupdown.c +++ b/cmd/ifupdown.c @@ -239,6 +239,7 @@ struct if_applet ifup_applet = { .desc = "bring interfaces up", .main = ifupdown_main, .usage = "ifup [options] ", + .manpage = "8 ifup", .groups = { &global_option_group, &match_option_group, &exec_option_group, }, }; @@ -247,5 +248,6 @@ struct if_applet ifdown_applet = { .desc = "take interfaces down", .main = ifupdown_main, .usage = "ifdown [options] ", + .manpage = "8 ifdown", .groups = { &global_option_group, &match_option_group, &exec_option_group, }, };