summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-04-23 15:38:16 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-04-23 15:38:16 +0200
commit160c6ec5eb369d309350e9fdf588e29d4ea215bd (patch)
treee3fc59f1dba568d3b2f895c6fca2626045a609dd /remote.c
parent88f13b1b296218589a44dac227964a8a47a75e50 (diff)
downloadvdr-160c6ec5eb369d309350e9fdf588e29d4ea215bd.tar.gz
vdr-160c6ec5eb369d309350e9fdf588e29d4ea215bd.tar.bz2
Implemented replay progress display
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/remote.c b/remote.c
index 84737aa2..f547add7 100644
--- a/remote.c
+++ b/remote.c
@@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and
* how to reach the author.
*
- * $Id: remote.c 1.4 2000/04/22 15:21:41 kls Exp $
+ * $Id: remote.c 1.5 2000/04/23 14:41:21 kls Exp $
*/
#include "remote.h"
@@ -51,9 +51,8 @@ cRcIo::~cRcIo()
close(f);
}
-int cRcIo::ReceiveByte(bool Wait)
+bool cRcIo::InputAvailable(bool Wait)
{
- // Returns the byte if one was received within a timeout, -1 otherwise
if (f >= 0) {
fd_set set;
struct timeval timeout;
@@ -61,13 +60,19 @@ int cRcIo::ReceiveByte(bool Wait)
timeout.tv_usec = Wait ? 0 : 10000;
FD_ZERO(&set);
FD_SET(f, &set);
- if (select(FD_SETSIZE, &set, NULL, NULL, &timeout) > 0) {
- if (FD_ISSET(f, &set)) {
- unsigned char b;
- if (read(f, &b, 1) == 1)
- return b;
- }
- }
+ if (select(FD_SETSIZE, &set, NULL, NULL, &timeout) > 0)
+ return FD_ISSET(f, &set);
+ }
+ return false;
+}
+
+int cRcIo::ReceiveByte(bool Wait)
+{
+ // Returns the byte if one was received within a timeout, -1 otherwise
+ if (InputAvailable(Wait)) {
+ unsigned char b;
+ if (read(f, &b, 1) == 1)
+ return b;
}
return -1;
}