Permalink
Browse files

added fionread for proper keypress

  • Loading branch information...
1 parent aa4f7dd commit a2219235966fe5b1d3f9c69f61f11e48a7b7fa54 @tz1 committed May 4, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 v1test.c
View
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/ioctl.h>
#define REQVERSION (1)
#define RESPVERSION (2)
@@ -86,11 +87,15 @@ static char *pullp(const char *p)
static int readpkt(unsigned char *);
static unsigned char respget[];
static int getkey() {
- return getchar();
+ char c;
+ read( 0, &c, 1 );
+ return c;
}
static int keypress() {
- return 0;//getchar();
+ int v;
+ ioctl( 0, FIONREAD, &v );
+ return v > 1;//getchar();
}

0 comments on commit a221923

Please sign in to comment.