[GHC] #3199: System.Environment provides no access to argv[0]
GHC
trac at galois.com
Tue Apr 28 17:06:34 EDT 2009
#3199: System.Environment provides no access to argv[0]
------------------------------+---------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.10.2
Severity: normal | Resolution:
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
------------------------------+---------------------------------------------
Comment (by sof):
This might be of some utility..
{{{
{-# LANGUAGE ForeignFunctionInterface #-}
-- What GHC.Environment leaves out.
module Main where
import Foreign
import Foreign.C
getFullProgName :: IO String
getFullProgName =
alloca $ \ p_argc ->
alloca $ \ p_argv -> do
getFullProgArgv p_argc p_argv
peek p_argv >>= peek >>= peekCString
foreign import ccall unsafe "getFullProgArgv"
getFullProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO ()
main = getFullProgName >>= putStrLn
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3199#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list