diff options
author | ross <unknown> | 2003-04-11 10:00:07 +0000 |
---|---|---|
committer | ross <unknown> | 2003-04-11 10:00:07 +0000 |
commit | 48a465bb8496b2a43f0f6a4821f2f15850e92b63 (patch) | |
tree | b7ba3658814d68be11f9def8ec0d024a4644d61f | |
parent | ad36edace08e06b26317f5c5002af321fb54d64a (diff) |
[project @ 2003-04-11 10:00:07 by ross]
move environ from C to Haskell
-rw-r--r-- | System/Posix/Env.hsc | 6 | ||||
-rw-r--r-- | include/HsUnix.h | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc index 239992c..979b981 100644 --- a/System/Posix/Env.hsc +++ b/System/Posix/Env.hsc @@ -30,6 +30,7 @@ import Foreign.C.Types ( CInt ) import Foreign.C.String import Foreign.Marshal.Array import Foreign.Ptr +import Foreign.Storable import Control.Monad ( liftM ) import Data.Maybe ( fromMaybe ) @@ -54,11 +55,12 @@ foreign import ccall unsafe "getenv" getEnvironmentPrim :: IO [String] getEnvironmentPrim = do + c_environ <- peek c_environ_p arr <- peekArray0 nullPtr c_environ mapM peekCString arr -foreign import ccall unsafe "__hsunix_environ" - c_environ :: Ptr CString +foreign import ccall unsafe "&environ" + c_environ_p :: Ptr (Ptr CString) -- |'getEnvironment' retrieves the entire environment as a -- list of @(key,value)@ pairs. diff --git a/include/HsUnix.h b/include/HsUnix.h index 4904dae..f5ce702 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsUnix.h,v 1.7 2003/04/11 09:43:38 ross Exp $ + * $Id: HsUnix.h,v 1.8 2003/04/11 10:00:07 ross Exp $ * * (c) The University of Glasgow 2002 * @@ -84,7 +84,6 @@ INLINE int __hsunix_wifsignaled (int stat) { return WIFSIGNALED(stat); } INLINE int __hsunix_wtermsig (int stat) { return WTERMSIG(stat); } INLINE int __hsunix_wifstopped (int stat) { return WIFSTOPPED(stat); } INLINE int __hsunix_wstopsig (int stat) { return WSTOPSIG(stat); } -INLINE char ** __hsunix_environ () { return environ; } #ifdef HAVE_RTLDNEXT INLINE void *__hsunix_rtldNext (void) {return RTLD_NEXT;} |