diff options
author | Ian Moffett <ian@osmora.org> | 2025-08-19 17:50:55 +0000 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-08-19 18:26:14 +0000 |
commit | a49e0a6980e3bbbea1365bd18e989b95b8f3cf02 (patch) | |
tree | 259fa110d2d8fc709b9d811a5336150fc5dac322 /usr.bin/reboot | |
parent | 633645d9f0bebf8f5d813e34d0e9684977253a7c (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.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 <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_POWEROFF); + printf("POWEROFF failed\n"); + /* Fall through */ default: printf("got bad flag '%c'\n", c); break; |