* We don't want to block here */
ndelay_on(1);
printf("\r\nLogin timed out after %d seconds\r\n", TIMEOUT);
- fflush(stdout);
+ fflush(NULL);
/* unix API is brain damaged regarding O_NONBLOCK,
* we should undo it, or else we can affect other processes */
ndelay_off(1);
}
printf(def ? "%s (y/n)? " : "%s (n/y)? ", string);
for (;;) {
- fflush(stdout);
+ fflush(NULL);
c = getchar();
if (c == EOF) {
if (!def)
errors_uncorrected = 1;
return def;
}
- c = toupper(c);
- if (c == 'Y') {
+ if (c == '\n')
+ break;
+ c |= 0x20; /* tolower */
+ if (c == 'y') {
def = 1;
break;
- } else if (c == 'N') {
+ }
+ if (c == 'n') {
def = 0;
break;
- } else if (c == ' ' || c == '\n')
- break;
+ }
}
if (def)
printf("y\n");
seconds = xatoi(opt_seconds);
if (opt & RTCWAKE_OPT_TIME)
/* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */
- alarm_time = xatoi(opt_time);
+ alarm_time = xatol(opt_time);
if (!alarm_time && !seconds)
bb_error_msg_and_die("must provide wake time");
/* relative or absolute alarm time, normalized to time_t */
sys_time = time(NULL);
- if (sys_time == (time_t)-1)
- bb_perror_msg_and_die("read system time");
rtc_time = rtc_read_time(fd, utc);
if (alarm_time) {
sync();
printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time));
- fflush(stdout);
+ fflush(NULL);
usleep(10 * 1000);
if (strcmp(suspend, "on"))