Handle argument special parameters

* geesh/word.scm (parameter-ref): Handle numeric argument parameters
and the argument count parameter ('$#').
This commit is contained in:
Timothy Sample 2018-12-04 12:53:32 -05:00
parent 2543ecd2bb
commit c64d16f428
1 changed files with 7 additions and 1 deletions

View File

@ -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,