Fix #294: shutdown --help mistakenly shuts down system

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-06-29 08:13:33 +02:00
1 parent caa398816d
commit 31ac933d64
1 file changed
+3 -3
+3 -3
View File
@@ -103,7 +103,7 @@ static int usage(int rc)
{ {
fprintf(stderr, "Usage: %s [OPTIONS]\n\n" fprintf(stderr, "Usage: %s [OPTIONS]\n\n"
"Options:\n" "Options:\n"
" --help This help text\n" " -?, --help This help text\n"
" -f, --force Force unsafe %s now, do not contact the init system.\n" " -f, --force Force unsafe %s now, do not contact the init system.\n"
" --halt Halt system, regardless of how the command is called.\n" " --halt Halt system, regardless of how the command is called.\n"
" -h Halt or power off after shutdown.\n" " -h Halt or power off after shutdown.\n"
@@ -116,15 +116,15 @@ static int usage(int rc)
int reboot_main(int argc, char *argv[]) int reboot_main(int argc, char *argv[])
{ {
int c, force = 0;
struct option long_options[] = { struct option long_options[] = {
{"help", 0, NULL, 'h'}, {"help", 0, NULL, '?'},
{"force", 0, NULL, 'f'}, {"force", 0, NULL, 'f'},
{"halt", 0, NULL, 'H'}, {"halt", 0, NULL, 'H'},
{"poweroff", 0, NULL, 'p'}, {"poweroff", 0, NULL, 'p'},
{"reboot", 0, NULL, 'r'}, {"reboot", 0, NULL, 'r'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
int c, force = 0;
/* Initial command taken from program name */ /* Initial command taken from program name */
transform(prognm); transform(prognm);