diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/shalt.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/shalt.c b/bin/shalt.c new file mode 100644 index 0000000..924d85d --- /dev/null +++ b/bin/shalt.c @@ -0,0 +1,13 @@ +#include <unistd.h> +#include <sys/reboot.h> + +/* Simple halt utility */ +/* Reboot if the argument is r, Poweroff is the argument is p */ + +int main (int argc, char *argv[]) { + switch ((int)argv[argc < 2 ? 0 : 1][0] + geteuid()) { + case 'p': reboot(RB_POWER_OFF); break; + case 'r': reboot(RB_AUTOBOOT); break; + default: return 1; + }; return 0; +} |