10 input_timeout (int filedes
, unsigned int seconds
)
13 struct timeval timeout
;
16 /* Initialize the file descriptor set. */
18 FD_SET (filedes
, &set
);
20 /* Initialize the timeout data structure. */
21 timeout
.tv_sec
= seconds
;
25 /* @code{select} returns 0 if timeout, 1 if input available, -1 if error. */
26 return TEMP_FAILURE_RETRY (select (FD_SETSIZE
,
36 fprintf (stderr
, "select returned %d.\n",
37 input_timeout (STDIN_FILENO
, 5));