Proposal: Add getFullProgName

Chris Dornan chris at chrisdornan.com
Wed Jun 13 03:01:45 CEST 2012


Isn't this about 24 years overdue? Can we do it now.

(Only kidding, but seriously...)

Chris

-----Original Message-----
From: libraries-bounces at haskell.org [mailto:libraries-bounces at haskell.org]
On Behalf Of Johan Tibell
Sent: 13 June 2012 00:57
To: Haskell Libraries
Subject: Proposal: Add getFullProgName

Hi,

getProgName is only useful in case you want to print the program name to the
screen. You cannot actually use it to do anything interesting
programmatically (like execv:ing the program.) I suggest we add
getFullProgName which does the sensible thing of returning argv[0].
Here's an implementation:

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 ()

Discussion deadline: 2 weeks

-- Johan

_______________________________________________
Libraries mailing list
Libraries at haskell.org
http://www.haskell.org/mailman/listinfo/libraries




More information about the Libraries mailing list