aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHank <hanketsu@egregore.fun>2025-04-06 13:12:01 +0200
committerHank <hanketsu@egregore.fun>2025-04-06 13:12:01 +0200
commit03645bd322b86b2a6001d9241d08dec6c28015dc (patch)
tree5aeff05d8028ed5342733746a4c2d70a0c87681c
parent4a5b41137453ecea50a063c1550fce8b69da43ba (diff)
fix: better error messages
-rw-r--r--pm-suspend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pm-suspend.c b/pm-suspend.c
index 5ff5abe..cb382c5 100644
--- a/pm-suspend.c
+++ b/pm-suspend.c
@@ -4,8 +4,14 @@
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) {
- printf("%s is unable to write to /sys/power/state.\nAdd the setuid bit?\n", argv[0]);
+ fprintf(stderr, "%s is unable to write to /sys/power/state.\nAdd the setuid bit?\n", argv[0]);
exit(1);
}