Line | |
---|
1 | (in-package :system/posix-syscalls) |
---|
2 | |
---|
3 | (defun c-library-reference () |
---|
4 | (#"getInstance" 'com.sun.jna.NativeLibrary "c")) |
---|
5 | |
---|
6 | (defun getenv (variable) |
---|
7 | (let ((found (#"invokePointer" |
---|
8 | (#"getFunction" (c-library-reference) "getenv") |
---|
9 | (java:jnew-array-from-list "java.lang.Object" (list variable))))) |
---|
10 | (when found |
---|
11 | (#"getString" found 0)))) |
---|
12 | |
---|
13 | (defun putenv (variable value) |
---|
14 | (let ((variable=value |
---|
15 | (java:jnew-array-from-list "java.lang.Object" |
---|
16 | (list |
---|
17 | (format nil "~a=~a" |
---|
18 | variable value))))) |
---|
19 | (#"invokeInt" |
---|
20 | (#"getFunction" (c-library-reference) "putenv") |
---|
21 | variable=value))) |
---|
22 | |
---|
23 | (defun unsetenv (variable) |
---|
24 | (when |
---|
25 | (= 0 |
---|
26 | (#"invokeInt" |
---|
27 | (#"getFunction" (c-library-reference) "unsetenv") |
---|
28 | (java:jnew-array-from-list "java.lang.Object" (list variable)))) |
---|
29 | t)) |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | |
---|
Note: See
TracBrowser
for help on using the repository browser.