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)
|
#:use-module (srfi srfi-26)
|
||||||
#:export (get-status
|
#:export (get-status
|
||||||
set-status!
|
set-status!
|
||||||
|
get-root-pid
|
||||||
getvar
|
getvar
|
||||||
setvar!
|
setvar!
|
||||||
unsetvar!
|
unsetvar!
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
;;; Status.
|
;;; Status and PID.
|
||||||
|
|
||||||
(define *status* 0)
|
(define *status* 0)
|
||||||
|
|
||||||
|
@ -72,6 +73,11 @@
|
||||||
"Set the current status."
|
"Set the current status."
|
||||||
(set! *status* n))
|
(set! *status* n))
|
||||||
|
|
||||||
|
(define *root-pid* (getpid))
|
||||||
|
|
||||||
|
(define (get-root-pid)
|
||||||
|
*root-pid*)
|
||||||
|
|
||||||
|
|
||||||
;;; Variables.
|
;;; Variables.
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ the environment. If @var{name} is unset, return @code{#f}."
|
||||||
("0" (car (program-arguments)))
|
("0" (car (program-arguments)))
|
||||||
("#" (number->string (length (cdr (program-arguments)))))
|
("#" (number->string (length (cdr (program-arguments)))))
|
||||||
("?" (number->string (get-status)))
|
("?" (number->string (get-status)))
|
||||||
|
("$" (number->string (get-root-pid)))
|
||||||
(x (let ((n (string->number x)))
|
(x (let ((n (string->number x)))
|
||||||
(if (and n (integer? n) (> n 0)
|
(if (and n (integer? n) (> n 0)
|
||||||
(<= n (length (cdr (program-arguments)))))
|
(<= n (length (cdr (program-arguments)))))
|
||||||
|
|
Loading…
Reference in New Issue