From f61a872bfc24191c3d43f7adeec32f3c5cd146e6 Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 24 Jan 2017 01:22:50 -0600 Subject: was thinking of switching to select code. not sure how I will yet. oh well. --- src/hackvr.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/hackvr.c') diff --git a/src/hackvr.c b/src/hackvr.c index b1819cb..5c0d0b8 100644 --- a/src/hackvr.c +++ b/src/hackvr.c @@ -7,7 +7,7 @@ #include #include #include -//#include //code to use select instead of non-blocking is commented out. might decide to use it later. +#include //code to use select instead of non-blocking is commented out. might decide to use it later. #include #define __USE_GNU //for longer math constants #include @@ -100,19 +100,22 @@ int load_stdin() { int i;//used to store the last triangle. even though I have a global for that. >_> // printf("# entering load_stdin()\n"); +#ifdef _HACKVR_USE_NONBLOCK_ for(i=0;global.shape[i];i++) ;//hop to the end. fcntl(0,F_SETFL,O_NONBLOCK); if(feof(stdin)) { clearerr(stdin); } - // readfs=master; - // timeout.tv_sec=0; - // timeout.tv_usec=1; - // if((j=select(1,&readfs,0,0,&timeout)) == -1) { - // perror("select"); - // return 0; - // } - // if(FD_ISSET(0,&readfs)) { +#else +/* readfs=master; + timeout.tv_sec=0; + timeout.tv_usec=1; + if((j=select(1,&readfs,0,0,&timeout)) == -1) { + perror("select"); + return 0; + } + if(FD_ISSET(0,&readfs)) {*/ +#endif while((line=read_line_hack(stdin,0))) {//load as long there's something to load if(*line == '#') return 0; // printf("# read command: %s\n",line); -- cgit v1.2.3