simplify reading with read-all - holymoly - A tor enabled gopher client written in CHICKEN scheme
 (HTM) git clone git://vernunftzentrum.de/holymoly.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ba38ca12811a4b1c0fe67ea6fae55314ff036035
 (DIR) parent fb810a280878b4732fb0f0547d03fd8fac24bcef
 (HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
       Date:   Tue, 24 Apr 2018 15:35:17 +0200
       
       simplify reading with read-all
       
       Diffstat:
         holymoly.scm                        |      15 +++++----------
       
       1 file changed, 5 insertions(+), 10 deletions(-)
       ---
 (DIR) diff --git a/holymoly.scm b/holymoly.scm
       @@ -9,7 +9,8 @@
            matchable
            srfi-71
            srfi-4
       -    uri-common)
       +    uri-common
       +    utils)
        
        (include "proxy.scm")
        (include "cursor.scm")
       @@ -149,14 +150,6 @@
                 (wrefresh (status-win))
                 (doupdate))))
        
       -
       -(define (read-until delim port)
       -  (let rl ((r '())
       -          (l (read-line port)))
       -    (if (or (equal? delim l) (eof-object? l))
       -        (reverse r)
       -        (rl (cons l r) (read-line port)))))
       -
        (define (request-resource server #!optional (resource index) (port gopher-port) until-eof?)
          (new-status "Connecting to ~a:~a ~a " server port resource)
          (condition-case
       @@ -167,7 +160,9 @@
               (display (string-append resource (string #\linefeed #\return)) o)
               (let ((response (if until-eof?
                                  (read-u8vector #f i)
       -                          (read-until "." i))))
       +                          (let* ((raw (read-all i))
       +                                 (l (string-split raw "\r\n")))
       +                             (butlast l)))))
                 (close-input-port i)
                 (close-output-port o)
                 response))