Add support for $$
* geesh/environment.scm (*root-pid*): New variable. (get-root-pid): New public function. * geesh/word.scm (parameter-ref): Handle '$'.
This commit is contained in:
parent
6b38897dc5
commit
177953c4b0
|
@ -23,6 +23,7 @@
|
|||
#:use-module (srfi srfi-26)
|
||||
#:export (get-status
|
||||
set-status!
|
||||
get-root-pid
|
||||
getvar
|
||||
setvar!
|
||||
unsetvar!
|
||||
|
@ -60,7 +61,7 @@
|
|||
;;; Code:
|
||||
|
||||
|
||||
;;; Status.
|
||||
;;; Status and PID.
|
||||
|
||||
(define *status* 0)
|
||||
|
||||
|
@ -72,6 +73,11 @@
|
|||
"Set the current status."
|
||||
(set! *status* n))
|
||||
|
||||
(define *root-pid* (getpid))
|
||||
|
||||
(define (get-root-pid)
|
||||
*root-pid*)
|
||||
|
||||
|
||||
;;; Variables.
|
||||
|
||||
|
|
|
@ -230,6 +230,7 @@ the environment. If @var{name} is unset, return @code{#f}."
|
|||
("0" (car (program-arguments)))
|
||||
("#" (number->string (length (cdr (program-arguments)))))
|
||||
("?" (number->string (get-status)))
|
||||
("$" (number->string (get-root-pid)))
|
||||
(x (let ((n (string->number x)))
|
||||
(if (and n (integer? n) (> n 0)
|
||||
(<= n (length (cdr (program-arguments)))))
|
||||
|
|
Loading…
Reference in New Issue