From c64d16f428ce4041c1ebae6750e0eccc16abd58e Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Tue, 4 Dec 2018 12:53:32 -0500 Subject: [PATCH] Handle argument special parameters * geesh/word.scm (parameter-ref): Handle numeric argument parameters and the argument count parameter ('$#'). --- geesh/word.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/geesh/word.scm b/geesh/word.scm index ca44d98..bc01caa 100644 --- a/geesh/word.scm +++ b/geesh/word.scm @@ -227,8 +227,14 @@ the environment. If @var{name} is unset, return @code{#f}." (string #\space #\tab #\newline))) (sep (argument-separator ifs))) (string-join (cdr (program-arguments)) sep))) + ("0" (car (program-arguments))) + ("#" (number->string (length (cdr (program-arguments))))) ("?" (number->string (get-status))) - (_ (getvar name dflt)))) + (x (let ((n (string->number x))) + (if (and n (integer? n) (> n 0) + (<= n (length (cdr (program-arguments))))) + (list-ref (program-arguments) n) + (getvar name dflt)))))) (define (word->qword word) "Convert @var{word} into a qword by resolving all parameter, command,