summaryrefslogtreecommitdiffhomepage
path: root/util-linux/rtcwake.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-19 08:18:50 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-19 08:18:50 +0000
commitae4342ca3e30f7b11732ecda3ad15821e81bc314 (patch)
tree1878104940eac4649bc8add4d0b2893ab1cb0a94 /util-linux/rtcwake.c
parentee56e013cfb6304f66129afee7978b0864699419 (diff)
- Rename getpty() to xgetpty() and adjust callers.
- Rewrite kbd_mode and setconsole - Introduce and use console_make_active() and xopen_xwrite_close() - honour buffer-reservation method as set by the user (dumpkmap, loadkmap) - shrink rtcwake and some console-tools Saves about 270 Bytes
Diffstat (limited to 'util-linux/rtcwake.c')
-rw-r--r--util-linux/rtcwake.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 6df7334fe..515f812b3 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -30,7 +30,7 @@
static time_t rtc_time;
-static int may_wakeup(const char *rtcname)
+static bool may_wakeup(const char *rtcname)
{
ssize_t ret;
char buf[128];
@@ -42,7 +42,7 @@ static int may_wakeup(const char *rtcname)
snprintf(buf, sizeof(buf), SYS_RTC_PATH, rtcname);
ret = open_read_close(buf, buf, sizeof(buf));
if (ret < 0)
- return 0;
+ return false;
/* wakeup events could be disabled or not supported */
return strncmp(buf, "enabled\n", 8) == 0;
@@ -89,15 +89,6 @@ static void setup_alarm(int fd, time_t *wakeup)
}
}
-static void suspend_system(const char *suspend)
-{
- FILE *f = xfopen(SYS_POWER_PATH, "w");
- fprintf(f, "%s\n", suspend);
- fflush(f);
- /* this executes after wake from suspend */
- fclose(f);
-}
-
#define RTCWAKE_OPT_AUTO 0x01
#define RTCWAKE_OPT_LOCAL 0x02
#define RTCWAKE_OPT_UTC 0x04
@@ -185,7 +176,7 @@ int rtcwake_main(int argc ATTRIBUTE_UNUSED, char **argv)
usleep(10 * 1000);
if (strcmp(suspend, "on"))
- suspend_system(suspend);
+ xopen_xwrite_close(SYS_POWER_PATH, suspend);
else {
/* "fake" suspend ... we'll do the delay ourselves */
unsigned long data;