- 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
This commit is contained in:
Bernhard Reutner-Fischer
2008-05-19 08:18:50 +00:00
parent ee56e013cf
commit ae4342ca3e
18 changed files with 136 additions and 142 deletions

View File

@ -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;