X-Git-Url: http://git.kpe.io/?p=uffi.git;a=blobdiff_plain;f=src%2Fcorman%2Fgetenv-ccl.lisp;h=966e0f7b0cb34bb5772ff576a8e524b3d065015b;hp=fa328615ee0fa2ae22048670837a806821454e6f;hb=b86fdf882156aa45dc6e8e93a158dedf506f4233;hpb=579b6d8e7ce89151996dd3ea9c29bb4419a4a8ed diff --git a/src/corman/getenv-ccl.lisp b/src/corman/getenv-ccl.lisp index fa32861..966e0f7 100644 --- a/src/corman/getenv-ccl.lisp +++ b/src/corman/getenv-ccl.lisp @@ -7,20 +7,13 @@ ;;;; Programmer: "Joe Marshall" ;;;; Date Started: Feb 2002 ;;;; -`;;;; $Id: getenv-ccl.lisp,v 1.1 2002/10/01 17:05:29 kevin Exp $ -;;;; -;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg -;;;; -;;;; UFFI users are granted the rights to distribute and use this software -;;;; as governed by the terms of the Lisp Lesser GNU Public License -;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* (in-package :cl-user) (ct:defun-dll c-getenv ((lpname LPSTR) - (lpbuffer LPSTR) - (nsize LPDWORD)) + (lpbuffer LPSTR) + (nsize LPDWORD)) :library-name "kernel32.dll" :return-type DWORD :entry-name "GetEnvironmentVariableA" @@ -34,7 +27,7 @@ (let* ((needed-size (c-getenv cname buffer nsizebuf)) (buffer1 (ct:malloc (1+ needed-size)))) (setf (ct:cref lpdword nsizebuf 0) needed-size) - (prog1 (if (zerop (c-getenv cname buffer1 nsizebuf)) + (prog1 (if (zerop (c-getenv cname buffer1 nsizebuf)) nil (ct:c-string-to-lisp-string buffer1)) (ct:free buffer1) @@ -58,7 +51,7 @@ (t (error "HOST must be a string, list of strings, NIL or :unspecific")))) ;| -(uffi:def-function ("getenv" c-getenv) +(uffi:def-function ("getenv" c-getenv) ((name :cstring)) :returning :cstring) @@ -67,11 +60,11 @@ (check-type key string) (uffi:with-cstring (key-native key) (uffi:convert-from-cstring (c-getenv key-native)))) - + #examples-uffi (progn (flet ((print-results (str) - (format t "~&(getenv ~S) => ~S" str (my-getenv str)))) + (format t "~&(getenv ~S) => ~S" str (my-getenv str)))) (print-results "USER") (print-results "_FOO_"))) @@ -80,7 +73,7 @@ (progn (util.test:test (my-getenv "_FOO_") nil :fail-info "Error retrieving non-existent getenv") (util.test:test (and (stringp (my-getenv "USER")) - (< 0 (length (my-getenv "USER")))) - t :fail-info "Error retrieving getenv") + (< 0 (length (my-getenv "USER")))) + t :fail-info "Error retrieving getenv") )