From 018a87286c655f74a05e80a8d26ae1b6a0499bdc Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Fri, 30 Jun 2017 12:04:44 +0200 Subject: [PATCH] initctl: Sort commands in usage according to topic Signed-off-by: Joachim Nilsson --- src/initctl.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/initctl.c b/src/initctl.c index b4a8063a..3d71fed7 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -574,66 +574,79 @@ static int show_status(char *arg) static int usage(int rc) { - fprintf(stderr, "Usage: %s [OPTIONS] \n\n" + fprintf(stderr, + "Usage: %s [OPTIONS] \n" + "\n" "Options:\n" " -d, --debug Debug initctl (client)\n" " -v, --verbose Verbose output\n" - " -h, --help This help text\n\n" + " -h, --help This help text\n" + "\n" "Commands:\n" " debug Toggle Finit (daemon) debug\n" " help This help text\n" - " log [NAME] Show ten last Finit, or NAME, messages from syslog\n" - " reload Reload *.conf in /etc/finit.d and activate changes\n" - " runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot\n" - " status | show Show status of services\n" + " version Show Finit version\n" "\n" " list List all .conf in /etc/finit.d/\n" " enable Enable .conf in /etc/finit.d/available/\n" " disable Disable .conf in /etc/finit.d/[enabled/]\n" + " reload Reload *.conf in /etc/finit.d/ (activates changes)\n" "\n" " cond set Set (assert) condition => +COND\n" " cond clear Clear (deassert) condition => -COND\n" " cond show Show condition status\n" " cond dump Show all conditions and their status\n" "\n" + " log [NAME] Show ten last Finit, or NAME, messages from syslog\n" " start [:ID] Start service by job# or name, with optional ID\n" " stop [:ID] Stop/Pause a running service by job# or name\n" " restart [:ID] Restart (stop/start) service by job# or name\n" + " status | show Show status of services\n" "\n" + " runlevel [0-9] Show or set runlevel: 0 halt, 6 reboot\n" " reboot Reboot system\n" " halt Halt system\n" " poweroff Halt and power off system\n" "\n" " utmp show Raw dump of UTMP/WTMP db\n" - " version Show Finit version\n\n", prognm); + "\n", prognm); return rc; } +static int do_help(char *arg) +{ + return usage(0); +} + int main(int argc, char *argv[]) { int c; command_t command[] = { { "debug", toggle_debug }, - { "log", do_log }, - { "reload", do_reload }, - { "runlevel", do_runlevel }, - { "status", show_status }, - { "show", show_status }, /* Convenience alias */ + { "help", do_help }, + { "version", show_version }, { "list", serv_list }, { "enable", serv_enable }, { "disable", serv_disable }, + { "reload", do_reload }, { "cond", do_cond }, + + { "log", do_log }, { "start", do_start }, { "stop", do_stop }, { "restart", do_restart }, + { "status", show_status }, + { "show", show_status }, /* Convenience alias */ + + { "runlevel", do_runlevel }, { "reboot", do_reboot }, { "halt", do_halt }, { "poweroff", do_poweroff }, + { "utmp", do_utmp }, - { "version", show_version }, { NULL, NULL } }; struct option long_options[] = {