summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2008-05-19 08:18:50 +0000
committerBernhard Reutner-Fischer2008-05-19 08:18:50 +0000
commitae4342ca3e30f7b11732ecda3ad15821e81bc314 (patch)
tree1878104940eac4649bc8add4d0b2893ab1cb0a94 /util-linux
parentee56e013cfb6304f66129afee7978b0864699419 (diff)
downloadbusybox-ae4342ca3e30f7b11732ecda3ad15821e81bc314.zip
busybox-ae4342ca3e30f7b11732ecda3ad15821e81bc314.tar.gz
- 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')
-rw-r--r--util-linux/rtcwake.c15
-rw-r--r--util-linux/script.c5
2 files changed, 4 insertions, 16 deletions
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 6df7334..515f812 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;
diff --git a/util-linux/script.c b/util-linux/script.c
index 63d3039..c188332 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -69,10 +69,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv)
shell = DEFAULT_SHELL;
}
- pty = getpty(pty_line);
- if (pty < 0) {
- bb_perror_msg_and_die("can't get pty");
- }
+ pty = xgetpty(pty_line);
/* get current stdin's tty params */
attr_ok = tcgetattr(0, &tt);