> Date: Sat, 22 Jun 2019 18:35:27 +0200
> From: Klemens Nanni <[email protected]>
>
> ldomctl(8) describes much more commands than the poor usage:
>
> $ ldomctl
> usage: ldomctl start|stop|panic domain
> ldomctl status [domain]
>
> Doing as vmctl already does, this diff turns it into
>
> usage: ldomctl command [argument ...]
> ldomctl delete configuration
> ldomctl download directory
> ldomctl dump
> ldomctl init-system file
> ldomctl list
> ldomctl panic domain
> ldomctl select configuration
> ldomctl start domain
> ldomctl status [domain]
> ldomctl stop domain
>
> The order of this output is lexicographically sorted exactly as in the
> manual page.
>
> OK?
Not sure such a long list is actually useful, but sure.
> Index: usr.sbin/ldomctl/ldomctl.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ldomctl/ldomctl.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 ldomctl.c
> --- usr.sbin/ldomctl/ldomctl.c 15 Sep 2018 13:20:16 -0000 1.21
> +++ usr.sbin/ldomctl/ldomctl.c 22 Jun 2019 16:10:40 -0000
> @@ -37,6 +37,7 @@ extern struct ds_service pri_service;
> struct command {
> const char *cmd_name;
> void (*cmd_func)(int, char **);
> + const char *usage;
> };
>
> __dead void usage(void);
> @@ -59,17 +60,17 @@ void guest_status(int argc, char **argv)
> void init_system(int argc, char **argv);
>
> struct command commands[] = {
> - { "download", download },
> - { "dump", dump },
> - { "list", list },
> - { "select", xselect },
> - { "delete", delete },
> - { "start", guest_start },
> - { "stop", guest_stop },
> - { "panic", guest_panic },
> - { "status", guest_status },
> - { "init-system", init_system },
> - { NULL, NULL }
> + { "delete", delete, "configuration" },
> + { "download", download, "directory" },
> + { "dump", dump, "" },
> + { "init-system", init_system, "file" },
> + { "list", list, "" },
> + { "panic", guest_panic, "domain" },
> + { "select", xselect, "configuration" },
> + { "start", guest_start, "domain" },
> + { "status", guest_status, "[domain]" },
> + { "stop", guest_stop, "domain" },
> + { NULL }
> };
>
> void hv_open(void);
> @@ -158,9 +159,13 @@ void
> usage(void)
> {
> extern char *__progname;
> + int i;
>
> - fprintf(stderr, "usage: %s start|stop|panic domain\n", __progname);
> - fprintf(stderr, " %s status [domain]\n", __progname);
> + fprintf(stderr, "usage:\t%s command [argument ...]\n", __progname);
> + for (i = 0; commands[i].cmd_name != NULL; i++) {
> + fprintf(stderr, "\t%s %s %s\n", __progname,
> + commands[i].cmd_name, commands[i].usage);
> + }
> exit(EXIT_FAILURE);
> }
>
>
>