summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-06-16 10:29:56 -0500
committerCase Duckworth2022-06-16 10:29:56 -0500
commit63c501ea109e648226e0274c3807b7b70dbf3d87 (patch)
tree6af987705f1dcdae976712d4ee22d5ec7ac2486a
parentConvert arguments to numbers (diff)
downloadqotd-63c501ea109e648226e0274c3807b7b70dbf3d87.tar.gz
qotd-63c501ea109e648226e0274c3807b7b70dbf3d87.zip
Fix string-length bug
-rwxr-xr-xqotd.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/qotd.scm b/qotd.scm index 394085d..da3aba8 100755 --- a/qotd.scm +++ b/qotd.scm
@@ -47,7 +47,8 @@ An implementation of the QOTD protocol (RFC 865)
47 #f)) 47 #f))
48 48
49(define (ensure-final-newline str) 49(define (ensure-final-newline str)
50 (cond ((char=? (string-ref str (- (string-length str) 1)) #\newline) str) 50 (cond ((not str) "\n")
51 ((char=? (string-ref str (- (string-length str) 1)) #\newline) str)
51 (else (string-append str "\n")))) 52 (else (string-append str "\n"))))
52 53
53(define (main arguments) 54(define (main arguments)