blob: 924d85d2f63a150ecb1c79fa018913832ba89beb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
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;
}
|