[cffi-devel] patch for uffi-compat
uffi 1.5.5 is out This patch add new function from it File uff-compat.diff ========================================== --- uffi-compat.lisp Fri Nov 4 12:12:12 2005 +++ uffi-compat.lisp Fri Nov 4 23:47:42 2005 @@ -91,6 +91,7 @@ ;; os #:run-shell-command + #:getenv )) (in-package #:cffi-uffi-compat) @@ -503,6 +504,35 @@ ;; Taken from UFFI's src/os.lisp ;; modified from function ASDF -- Copyright Dan Barlow and Contributors +(defun getenv (var) + "Return the value of the environment variable." + #+allegro (sys::getenv (string var)) + #+clisp (sys::getenv (string var)) + #+cmu (cdr (assoc (string var) ext:*environment-list* :test #'equalp + :key #'string)) + #+gcl (si:getenv (string var)) + #+lispworks (lw:environment-variable (string var)) + #+lucid (lcl:environment-variable (string var)) + #+mcl (ccl::getenv var) + #+sbcl (sb-ext:posix-getenv var) + #-(or allegro clisp cmu gcl lispworks lucid mcl sbcl) + (error 'not-implemented :proc (list 'getenv var))) + +(defun (setf getenv) (val var) + "Set an environment variable." + #+allegro (setf (sys::getenv (string var)) (string val)) + #+clisp (setf (sys::getenv (string var)) (string val)) + #+cmu (let ((cell (assoc (string var) ext:*environment-list* :test #'equalp + :key #'string))) + (if cell + (setf (cdr cell) (string val)) + (push (cons (intern (string var) "KEYWORD") (string val)) ext:*environment-list*))) + #+gcl (si:setenv (string var) (string val)) + #+lispworks (setf (lw:environment-variable (string var)) (string val)) + #+lucid (setf (lcl:environment-variable (string var)) (string val)) + #-(or allegro clisp cmu gcl lispworks lucid) + (error 'not-implemented :proc (list '(setf getenv) var))) + (defun run-shell-command (control-string &rest args &key output) "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and synchronously execute the result using a Bourne-compatible shell, with
On 2005-nov-05, at 07:51, Yaroslav Kavenchuk wrote:
+(defun getenv (var)
I'll add this to uffi-compat for the sake of compatibility. However I wonder if something similar should be added to CFFI? I guess not, until someone actually needs it and (defcfun getenv ...) is not enough. -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/ Equipa Portuguesa do Translation Project http://www.iro.umontreal.ca/translation/registry.cgi?team=pt
Luís Oliveira wrote:
+(defun getenv (var)
I'll add this to uffi-compat for the sake of compatibility. However I wonder if something similar should be added to CFFI? I guess not, until someone actually needs it and (defcfun getenv ...) is not enough.
Thanks! This need for the sake of compatibility only. CLSQL need it (from uffi). -- WBR, Yaroslav Kavenchuk.
participants (3)
-
Luís Oliveira
-
Yaroslav Kavenchuk
-
Yaroslav Kavenchuk