
posix-syscalls.getenv.lisp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of abcl-contrib Show documentation
Show all versions of abcl-contrib Show documentation
Extra contributions for ABCL code not necessarily
licensed under the GPLv2 with classpath exception.
The newest version!
(in-package :system/posix-syscalls)
(defun c-library-reference ()
(#"getInstance" 'com.sun.jna.NativeLibrary "c"))
(defun getenv (variable)
(let ((found (#"invokePointer"
(#"getFunction" (c-library-reference) "getenv")
(java:jnew-array-from-list "java.lang.Object" (list variable)))))
(when found
(#"getString" found 0))))
(defun putenv (variable value)
(let ((variable=value
(java:jnew-array-from-list "java.lang.Object"
(list
(format nil "~a=~a"
variable value)))))
(#"invokeInt"
(#"getFunction" (c-library-reference) "putenv")
variable=value)))
(defun unsetenv (variable)
(when
(= 0
(#"invokeInt"
(#"getFunction" (c-library-reference) "unsetenv")
(java:jnew-array-from-list "java.lang.Object" (list variable))))
t))
© 2015 - 2025 Weber Informatics LLC | Privacy Policy