diff options
| author | epoch <epoch@hacking.allowed.org> | 2017-01-24 01:22:50 -0600 | 
|---|---|---|
| committer | epoch <epoch@hacking.allowed.org> | 2017-01-24 01:22:50 -0600 | 
| commit | f61a872bfc24191c3d43f7adeec32f3c5cd146e6 (patch) | |
| tree | 0511c1a6e6b37c973610eab6efa55b769874173c | |
| parent | b17e3d4054cee8afca4263fc5e6dd477ba6579f3 (diff) | |
| download | hackvr-f61a872bfc24191c3d43f7adeec32f3c5cd146e6.tar.gz hackvr-f61a872bfc24191c3d43f7adeec32f3c5cd146e6.zip  | |
was thinking of switching to select code. not sure how I will yet. oh well.
| -rw-r--r-- | src/hackvr.c | 21 | 
1 files changed, 12 insertions, 9 deletions
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 <unistd.h>  #include <dirent.h>  #include <stdlib.h> -//#include <sys/select.h> //code to use select instead of non-blocking is commented out. might decide to use it later. +#include <sys/select.h> //code to use select instead of non-blocking is commented out. might decide to use it later.  #include <time.h>  #define __USE_GNU //for longer math constants  #include <math.h> @@ -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);  | 
