twitch: gopher: gophernicus support, output . for directory so it's valid - frontends - front-ends for some sites (experiment)
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 1fce873ce69a5ffd55f1f014bf3b0945136b3c67
 (DIR) parent a1f945aa4e2f95e49c370cee3736cdd9b61839aa
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat,  2 May 2020 16:36:20 +0200
       
       twitch: gopher: gophernicus support, output . for directory so it's valid
       
       Diffstat:
         M twitch/gopher.c                     |       9 ++++++---
       
       1 file changed, 6 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/twitch/gopher.c b/twitch/gopher.c
       @@ -355,8 +355,10 @@ handle_videos(void)
        
                /* login: if not set as query string parameter then use gopher search
                   parameter */
       -        if (login[0] == '\0' && (p = getenv("X_GOPHER_SEARCH"))) {
       -                if (decodeparam(login, sizeof(login), p) == -1)
       +        if (login[0] == '\0') {
       +                if (!(p = getenv("X_GOPHER_SEARCH"))) /* geomyidae */
       +                        p = getenv("SEARCHREQUEST"); /* gophernicus */
       +                if (p && decodeparam(login, sizeof(login), p) == -1)
                                login[0] = '\0';
                }
        
       @@ -427,7 +429,7 @@ handle_links(void)
        }
        
        int
       -main(int argc, char *argv[])
       +main(void)
        {
                char *p, path[256] = "", *querystring;
        
       @@ -467,6 +469,7 @@ main(int argc, char *argv[])
                        handle_links();
                } else {
                        error("Not Found");
       +                printf(".\r\n");
                        exit(1);
                }