it seems i sent the wrong patch (aehm...sorry). it lacks of the libusplash.h part.
just resent. -- -gaspa- ----------------------------------------------- --------- Powered by Debian GNU/Linux --------- ------ HomePage: iogaspa.altervista.org ------- -Il lunedi'dell'arrampicatore: www.lunedi.org -
diff -Naur usplash-0.5.2/libusplash.c usplash-0.5.2.orig/libusplash.c --- usplash-0.5.2/libusplash.c 2007-09-17 17:31:20.000000000 +0200 +++ usplash-0.5.2.orig/libusplash.c 2007-09-17 17:22:10.000000000 +0200 @@ -39,7 +39,6 @@ #include <dlfcn.h> #include <errno.h> #include <fcntl.h> -#include <poll.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -70,7 +69,7 @@ void clear_text(void); void draw_text(const char *string, size_t len); void draw_status(const char *string, size_t len, int mode); -int handle_input(const char *string, size_t len, int quiet,int timeout); +int handle_input(const char *string, size_t len, int quiet); /* Helpers for video implementations */ void usplash_restore_console(void); @@ -709,40 +708,14 @@ unblocksig(); } -char gettimeoutchar(int timeout) -{ - unsigned char charinput ='\0'; - int old_flags,retval; - struct pollfd input_fd = { - .fd = STDIN_FILENO, - .events = POLLIN, - }; - while( timeout ) - { - blocksig(); - if( poll( &input_fd, 1 , 1000) > 0 ) - { - if( read(STDIN_FILENO,&charinput,1) < 0 ) - charinput = '\0'; - break; - } - unblocksig(); - timeout--; - } - return charinput; -} - -int usplash_get_string(char *inputbuf, int length, int quiet,int timeout) +int usplash_get_string(char *inputbuf, int length, int quiet) { char input; int i; /* Get user input */ for (i = 0; i < length - 1; i++) { - if( timeout == -1 ) - input = getchar(); - else - input = gettimeoutchar(timeout); + input = getchar(); if (input == '\n' || input == '\r' || input == '\0') break; @@ -762,7 +735,7 @@ return i; } -int handle_input(const char *string, const size_t len, const int quiet,int timeout) +int handle_input(const char *string, const size_t len, const int quiet) { int i; ssize_t wlen; @@ -782,7 +755,7 @@ draw_text(string, len); /* Get the user input */ - usplash_get_string(inputbuf, PIPE_BUF, quiet,timeout); + usplash_get_string(inputbuf, PIPE_BUF, quiet); /* Reset the verbose flag */ if (reset_verbose) diff -Naur usplash-0.5.2/libusplash.h usplash-0.5.2.orig/libusplash.h --- usplash-0.5.2/libusplash.h 2007-09-18 09:10:14.000000000 +0200 +++ usplash-0.5.2.orig/libusplash.h 2007-09-17 17:22:10.000000000 +0200 @@ -32,7 +32,7 @@ void animate_step(int pulsating); int usplash_setup(int xres, int yres, int verbose); int strncspn(const char *s, size_t n, const char *reject); -int handle_input(const char *string, size_t len, int quiet,int timeout); +int handle_input(const char *string, size_t len, int quiet); int usplash_get_string (char *buf, int length, int quiet); extern struct usplash_theme testcard_theme; diff -Naur usplash-0.5.2/usplash.c usplash-0.5.2.orig/usplash.c --- usplash-0.5.2/usplash.c 2007-09-17 17:28:48.000000000 +0200 +++ usplash-0.5.2.orig/usplash.c 2007-09-17 17:22:10.000000000 +0200 @@ -171,7 +171,7 @@ } else if (retval < 0 && errno == EINTR) { /* Count cycles for timeout */ cycles++; - if (cycle_timeout && cycles >= cycle_timeout) + if (cycles >= cycle_timeout) return 0; } else if (retval > 0) { /* Data available */ @@ -280,23 +280,13 @@ pulsating = 1; } else if (!strncmp(command, "INPUT", commandlen)) { - return handle_input(string, len, 0,-1); + return handle_input(string, len, 0); } else if (!strncmp(command, "INPUTQUIET", commandlen)) { - return handle_input(string, len, 1,-1); + return handle_input(string, len, 1); } else if (!strncmp(command, "INPUTENTER", commandlen)) { - return handle_input(string, len, 2,-1); - } else if (!strncmp(command, "INPUTTIMEOUT", commandlen)) { - int timeout; - commandlen = strncspn(string, len, " "); - if (string[commandlen] == ' '){ - timeout = atoi(string); - string += commandlen ; - } - else - timeout = -1; - return handle_input(string, len, 0,timeout); + return handle_input(string, len, 2); } return 0;