getenv now returns #f for unset environment variables.
This commit is contained in:
parent
73f045a6c3
commit
b037b1b671
|
@ -309,15 +309,18 @@
|
||||||
($file-time x 'file-mtime
|
($file-time x 'file-mtime
|
||||||
(lambda (u) (foreign-call "ikrt_file_mtime2" u))))
|
(lambda (u) (foreign-call "ikrt_file_mtime2" u))))
|
||||||
|
|
||||||
(define ($getenv-bv key)
|
|
||||||
(foreign-call "ikrt_getenv" key))
|
|
||||||
(define ($getenv-str key)
|
|
||||||
(utf8->string ($getenv-bv (string->utf8 key))))
|
|
||||||
|
|
||||||
(define (getenv key)
|
(define (getenv key)
|
||||||
|
(define who 'getenv)
|
||||||
|
(define ($getenv-str key)
|
||||||
|
(define ($getenv-bv key)
|
||||||
|
(foreign-call "ikrt_getenv" key))
|
||||||
|
(let ([rv ($getenv-bv (string->utf8 key))])
|
||||||
|
(and rv (utf8->string rv))))
|
||||||
(if (string? key)
|
(if (string? key)
|
||||||
($getenv-str key)
|
($getenv-str key)
|
||||||
(die 'getenv "the key is not a string" key)))
|
(die who "key is not a string" key)))
|
||||||
|
|
||||||
(define env
|
(define env
|
||||||
(let ()
|
(let ()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1697
|
1698
|
||||||
|
|
|
@ -908,12 +908,7 @@ ikrt_getenv(ikptr bv, ikpcb* pcb){
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* empty bv */
|
return false_object;
|
||||||
ikptr s = ik_safe_alloc(pcb, align(disp_bytevector_data+1))
|
|
||||||
+ bytevector_tag;
|
|
||||||
ref(s, -bytevector_tag) = fix(0);
|
|
||||||
ref(s, off_bytevector_data) = 0;
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue