summaryrefslogtreecommitdiff
path: root/usr.bin/reboot
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-08-19 17:50:55 +0000
committerIan Moffett <ian@osmora.org>2025-08-19 17:50:55 +0000
commit0182351811ad04e3e40749e01c8b35d5f57d6af2 (patch)
treee3ad0294d0535a934e24d9e9a936f28830c0157c /usr.bin/reboot
parent633645d9f0bebf8f5d813e34d0e9684977253a7c (diff)
osh: Seperate 'shutdown' command from builtins
Gives the shutdown command its own binary in /usr/bin/shutdown Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/reboot')
-rw-r--r--usr.bin/reboot/reboot.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/reboot/reboot.c b/usr.bin/reboot/reboot.c
index 7fa37f9..445fe3b 100644
--- a/usr.bin/reboot/reboot.c
+++ b/usr.bin/reboot/reboot.c
@@ -31,9 +31,10 @@
#include <stdio.h>
#include <unistd.h>
-#define REBOOT_FLAGS "rh"
+#define REBOOT_FLAGS "rhp"
#define REBOOT_FLAG_RB 'r' /* Reboot */
#define REBOOT_FLAG_HLT 'h' /* Halt */
+#define REBOOT_FLAG_PWR 'p' /* Power off */
static void
help(void)
@@ -43,6 +44,7 @@ help(void)
"flags:\n"
" [-r] Reboot\n"
" [-h] Halt\n"
+ " [-p] Power off\n"
);
}
@@ -71,6 +73,10 @@ main(int argc, char **argv)
cpu_reboot(REBOOT_FLAG_HLT);
printf("HALT failed\n");
/* Fall through */
+ case REBOOT_FLAG_PWR:
+ cpu_reboot(REBOOT_FLAG_PWR);
+ printf("POWEROFF failed\n");
+ /* Fall through */
default:
printf("got bad flag '%c'\n", c);
break;