{-# LINE 1 "libraries/unix/System/Posix/Env/Internal.hsc" #-}
module System.Posix.Env.Internal where
import Foreign
import Foreign.C
getEnvironmentPrim :: IO [Ptr CChar]
getEnvironmentPrim :: IO [CString]
getEnvironmentPrim = do
Ptr CString
c_environ <- IO (Ptr CString)
getCEnviron
if Ptr CString
c_environ Ptr CString -> Ptr CString -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr CString
forall a. Ptr a
nullPtr
then [CString] -> IO [CString]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return []
else do
CString -> Ptr CString -> IO [CString]
forall a. (Storable a, Eq a) => a -> Ptr a -> IO [a]
peekArray0 CString
forall a. Ptr a
nullPtr Ptr CString
c_environ
getCEnviron :: IO (Ptr CString)
{-# LINE 25 "libraries/unix/System/Posix/Env/Internal.hsc" #-}
getCEnviron :: IO (Ptr CString)
getCEnviron = IO (Ptr CString)
_getCEnviron
foreign import ccall unsafe "__hsunix_get_environ"
_getCEnviron :: IO (Ptr CString)
{-# LINE 33 "libraries/unix/System/Posix/Env/Internal.hsc" #-}