;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: getenv.lisp,v 1.1 2002/09/30 10:02:36 kevin Exp $
+;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
;;;;
-;;;; 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)
-(uffi:def-function ("getenv" c-getenv)
+(uffi:def-function ("getenv" c-getenv)
((name :cstring))
:returning :cstring)
(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_")))
(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")
)