From a49e0a6980e3bbbea1365bd18e989b95b8f3cf02 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 19 Aug 2025 17:50:55 +0000 Subject: osh: Seperate 'shutdown' command from builtins Gives the shutdown command its own binary in /usr/bin/shutdown Signed-off-by: Ian Moffett --- usr.bin/reboot/reboot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'usr.bin/reboot/reboot.c') diff --git a/usr.bin/reboot/reboot.c b/usr.bin/reboot/reboot.c index 7fa37f9..07dc74f 100644 --- a/usr.bin/reboot/reboot.c +++ b/usr.bin/reboot/reboot.c @@ -31,9 +31,10 @@ #include #include -#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_POWEROFF); + printf("POWEROFF failed\n"); + /* Fall through */ default: printf("got bad flag '%c'\n", c); break; -- cgit v1.2.3