getenv now returns #f for unset environment variables.

This commit is contained in:
Abdulaziz Ghuloum 2008-12-05 02:19:26 -05:00
parent 73f045a6c3
commit b037b1b671
3 changed files with 10 additions and 12 deletions

View File

@ -309,15 +309,18 @@
($file-time x 'file-mtime
(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 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)
($getenv-str key)
(die 'getenv "the key is not a string" key)))
(die who "key is not a string" key)))
(define env
(let ()

View File

@ -1 +1 @@
1697
1698

View File

@ -908,12 +908,7 @@ ikrt_getenv(ikptr bv, ikpcb* pcb){
return s;
}
else {
/* empty bv */
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;
return false_object;
}
}