From 3ec520596c910a2e433af035e55c03af46ad6dd0 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Mon, 16 Jul 2018 10:03:58 -0400 Subject: [PATCH] Fix 'read-sh' to default to current input port * geesh/parser.scm (read-sh): Make the 'port' argument optional and default to using 'current-input-port'. --- geesh/parser.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/geesh/parser.scm b/geesh/parser.scm index c17d27e..fd8186a 100644 --- a/geesh/parser.scm +++ b/geesh/parser.scm @@ -776,10 +776,11 @@ bracket." ((? eof-object?) #f) (code code)))))) -(define (read-sh port) +(define* (read-sh #:optional (port #f)) "Read a complete Shell command from @var{port} (or the current input port if @var{port} is unspecified)." - (let* ((stop? #f) + (let* ((port (or port (current-output-port))) + (stop? #f) (stop! (lambda () (set! stop? #t))) (pre-lex (make-lexer port read-sh/bracketed read-sh/backquoted)) (lex (lambda () (if stop? '*eoi* (pre-lex))))