URI: 
       Fix infinite loop caused by search prompt - sacc - sacc(omys), simple console gopher client
  HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR LICENSE
       ---
   DIR commit cef484cbcf0ba83757f853f235a6cc7497448fa2
   DIR parent 90a9d3c81f27588c62faa43f22d946740042a3ce
  HTML Author: Rainer Holzner <rholzner@web.de>
       Date:   Fri, 20 Dec 2024 18:01:52 +0100
       
       Fix infinite loop caused by search prompt
       
       This fixes an infinite loop when the user selects item type 7 (IND),
       enters 1 or more characters and decides to cancel the search prompt
       by pressing Ctrl+D without deleting the input line.
       
       Note that the fixed version requires the user to press Ctrl-D twice
       in this case.
       
       Diffstat:
         M ui_ti.c                             |       3 ++-
         M ui_txt.c                            |       2 +-
       
       2 files changed, 3 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/ui_ti.c b/ui_ti.c
       @@ -97,7 +97,7 @@ uiprompt(char *fmt, ...)
                putp(tparm(restore_cursor, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                fflush(stdout);
        
       -        if (r == -1) {
       +        if (r == -1 || feof(stdin)) {
                        clearerr(stdin);
                        clear(&input);
                } else if (input[r - 1] == '\n') {
       @@ -531,6 +531,7 @@ uiselectitem(Item *entry)
                        case _key_searchprev:
                                searchinline(searchstr, entry, -1);
                                continue;
       +                case EOF:
                        case 0x04:
                        case _key_quit:
                        quit:
   DIR diff --git a/ui_txt.c b/ui_txt.c
       @@ -124,7 +124,7 @@ uiprompt(char *fmt, ...)
                mbsprint(bufout, columns);
                fflush(stdout);
        
       -        if ((r = getline(&input, &n, stdin)) == -1) {
       +        if ((r = getline(&input, &n, stdin)) == -1 || feof(stdin)) {
                        clearerr(stdin);
                        clear(&input);
                        putchar('\n');