URI: 
       tPrevent blocking on uiprompt error - sacc - sacc(omys), simple console gopher client (mirror)
  HTML git clone https://git.parazyd.org/sacc
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit a3ee498a2796928b86bdb2b6fd73c56af68dc0eb
   DIR parent 199205cac2adb7d40a2ef7f4e20ad617e6437323
  HTML Author: Quentin Rameau <quinq@fifth.space>
       Date:   Fri, 28 Jul 2017 23:18:00 +0200
       
       Prevent blocking on uiprompt error
       
       Thanks to Hiltjo for reporting this!
       
       Diffstat:
         M ui_ti.c                             |      14 ++++++--------
         M ui_txt.c                            |      12 +++++-------
       
       2 files changed, 11 insertions(+), 15 deletions(-)
       ---
   DIR diff --git a/ui_ti.c b/ui_ti.c
       t@@ -81,14 +81,12 @@ uiprompt(char *fmt, ...)
                putp(tparm(restore_cursor));
                fflush(stdout);
        
       -        if (r > 0) {
       -                if (input[r - 1] == '\n')
       -                        input[--r] = '\0';
       -                return input;
       -        }
       -
       -        free(input);
       -        return NULL;
       +        if (r < 0)
       +                clearerr(stdin);
       +        else if (input[r - 1] == '\n')
       +                input[--r] = '\0';
       +        
       +        return input;
        }
        
        static void
   DIR diff --git a/ui_txt.c b/ui_txt.c
       t@@ -83,14 +83,12 @@ uiprompt(char *fmt, ...)
        
                fflush(stdout);
        
       -        if ((r = getline(&input, &n, stdin)) > 0) {
       -                if (input[r - 1] == '\n')
       -                        input[--r] = '\0';
       -                return input;
       -        }
       +        if ((r = getline(&input, &n, stdin)) < 0)
       +                clearerr(stdin);
       +        else if (input[r - 1] == '\n')
       +                input[--r] = '\0';
        
       -        free(input);
       -        return NULL;
       +        return input;
        }
        
        void