URI:
       Merge pull request #82 from jwilk-forks/pselect - tty-clock - port of tty-clock to OpenBSD, with pledge/unveil added as goodie.
  HTML git clone https://git.drkhsh.at/tty-clock.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit e7eaef18cafd9995fa0ba5b8146c4648907b5983
   DIR parent 9278106c230bf3a69de40da0c458c184234ae846
  HTML Author: anarcat <anarcat@users.noreply.github.com>
       Date:   Mon,  4 May 2020 15:12:35 -0400
       
       Merge pull request #82 from jwilk-forks/pselect
       
       React to keyboard input without delay
       Diffstat:
         M ttyclock.c                          |      22 +++++++++++++---------
         M ttyclock.h                          |       1 +
       
       2 files changed, 14 insertions(+), 9 deletions(-)
       ---
   DIR diff --git a/ttyclock.c b/ttyclock.c
       @@ -415,6 +415,10 @@ key_event(void)
        
             struct timespec length = { ttyclock.option.delay, ttyclock.option.nsdelay };
             
       +     fd_set rfds;
       +     FD_ZERO(&rfds);
       +     FD_SET(STDIN_FILENO, &rfds);
       +
             if (ttyclock.option.screensaver)
             {
                  c = wgetch(stdscr);
       @@ -517,16 +521,16 @@ key_event(void)
                  set_box(!ttyclock.option.box);
                  break;
        
       -     default:
       -          nanosleep(&length, NULL);
       -          for(i = 0; i < 8; ++i)
       -               if(c == (i + '0'))
       -               {
       -                    ttyclock.option.color = i;
       -                    init_pair(1, ttyclock.bg, i);
       -                    init_pair(2, i, ttyclock.bg);
       -               }
       +     case '0': case '1': case '2': case '3':
       +     case '4': case '5': case '6': case '7':
       +          i = c - '0';
       +          ttyclock.option.color = i;
       +          init_pair(1, ttyclock.bg, i);
       +          init_pair(2, i, ttyclock.bg);
                  break;
       +
       +     default:
       +          pselect(1, &rfds, NULL, NULL, &length, NULL);
             }
        
             return;
   DIR diff --git a/ttyclock.h b/ttyclock.h
       @@ -40,6 +40,7 @@
        #include <signal.h>
        #include <stdlib.h>
        #include <string.h>
       +#include <sys/select.h>
        #include <sys/stat.h>
        #include <sys/types.h>
        #include <time.h>