X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fdreammachine%2Fstrobe.c;h=42dfece47ad4d62c2bd56773d92a8abf0fa3f537;hb=e6e13bcc33fa6040a7f00159516482dd3a6273be;hp=1c2c797f6abec6f40559d8985a05424a7b06e40c;hpb=1de77ebfaeed512dead17884b4f5e1a62f9dcc0d;p=mirrors%2FPrograms.git diff --git a/c/dreammachine/strobe.c b/c/dreammachine/strobe.c index 1c2c797..42dfece 100644 --- a/c/dreammachine/strobe.c +++ b/c/dreammachine/strobe.c @@ -3,10 +3,16 @@ * usage ./strobe [frequency] */ +//#define __WIN32__ #include #include #include #include +#ifndef __WIN32__ + #include +#else + #include +#endif void signal_handler(int signo) { if(signo == SIGTERM || signo == SIGINT || signo == SIGQUIT) { @@ -48,6 +54,16 @@ int main(int argc, char *argv[]) { fputs(state_a, stdout); fflush(stdout); usleep(half_interval); +/* + #ifndef __WIN32__ + int fflags = fcntl(fileno(stdin), F_GETFL, 0); + fcntl(fileno(stdin), F_SETFL, fflags | O_NONBLOCK); + while(getchar()) puts("."); + fcntl(fileno(stdin), F_SETFL, fflags); + #else + //WARNING! Somehow implement FILE_FLAG_OVERLAPPED & FILE_FLAG_NO_BUFFERING support on windows + #endif +*/ if(argc > 2) getchar(); //interactive strobe fputs(state_b, stdout); fflush(stdout);