summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-07-15 12:39:20 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-07-15 12:39:20 +0200
commit20019e7ce51b9e14ce28f96b263b76e6becd4184 (patch)
tree183c0f3bac333786eb71f6825ce40412b8cb7ab4 /tools.c
parent5c574ffb7bba34506479247bf6d924e090bc2d10 (diff)
downloadvdr-0.0.6.tar.gz
vdr-0.0.6.tar.bz2
Added support for LIRC remote control0.0.6
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/tools.c b/tools.c
index eb0a14a4..c0eb2ec5 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.7 2000/04/24 15:01:35 kls Exp $
+ * $Id: tools.c 1.8 2000/06/24 15:26:15 kls Exp $
*/
#define _GNU_SOURCE
@@ -22,15 +22,18 @@
int SysLogLevel = 3;
-bool DataAvailable(int filedes)
+bool DataAvailable(int filedes, bool wait)
{
- fd_set set;
- FD_ZERO(&set);
- FD_SET(filedes, &set);
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 10000;
- return select(FD_SETSIZE, &set, NULL, NULL, &timeout) > 0 && FD_ISSET(filedes, &set);
+ if (filedes >= 0) {
+ fd_set set;
+ FD_ZERO(&set);
+ FD_SET(filedes, &set);
+ struct timeval timeout;
+ timeout.tv_sec = wait ? 1 : 0;
+ timeout.tv_usec = wait ? 0 : 10000;
+ return select(FD_SETSIZE, &set, NULL, NULL, &timeout) > 0 && FD_ISSET(filedes, &set);
+ }
+ return false;
}
void writechar(int filedes, char c)