blob: cb382c572ea8e2fbc0cfae825e14dfa8d0a69548 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
FILE *f = fopen("/sys/power/state", "w");
if(argc != 2) {
fprintf(stderr, "%s [mem|standby|freeze|disk]\n", argv[0]);
exit(1);
}
if(f == NULL) {
fprintf(stderr, "%s is unable to write to /sys/power/state.\nAdd the setuid bit?\n", argv[0]);
exit(1);
}
fprintf(f, "%s", argv[1]);
fclose(f);
}
|