Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added fionread for proper keypress

  • Loading branch information...
commit a2219235966fe5b1d3f9c69f61f11e48a7b7fa54 1 parent aa4f7dd
@tz1 authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 v1test.c
View
9 v1test.c
@@ -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();
}
Please sign in to comment.
Something went wrong with that request. Please try again.