From be310c3938beda74ac048a0d4a29f5bc86368da1 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 2 Jul 2002 10:33:23 +0000 Subject: [PATCH] [project @ 2002-07-02 10:33:23 by simonmar] Documentation for getProgName. --- System/Environment.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/System/Environment.hs b/System/Environment.hs index 20b709f..f99df14 100644 --- a/System/Environment.hs +++ b/System/Environment.hs @@ -48,9 +48,16 @@ getArgs = foreign import ccall unsafe "getProgArgv" getProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO () --- Computation `getProgName' returns the name of the program --- as it was invoked. - +{-| +Computation 'getProgName' returns the name of the program as it was +invoked. + +However, this is hard-to-impossible to implement on some non-Unix +OSes, so instead, for maximum portability, we just return the leafname +of the program as invoked. Even then there are some differences +between platforms: on Windows, for example, a program invoked as foo +is probably really @FOO.EXE@, and that is what 'getProgName' will return. +-} getProgName :: IO String getProgName = alloca $ \ p_argc -> -- 1.7.10.4