[project @ 2000-05-01 14:53:47 by panne]
[ghc-hetmet.git] / ghc / lib / std / System.lhs
index 41373d1..c61cb32 100644 (file)
@@ -137,7 +137,10 @@ exitWith (ExitFailure n)
     primExit n
     ioError (IOError Nothing OtherError "exitWith" "exit should not return")
 
-foreign import ccall "shutdownHaskellAndExit" primExit :: Int -> IO ()
+-- SUP: Although shutdownHaskellAndExit is declared "unsafe" below, it *can*
+-- re-enter Haskell land through finalizers. But this is probably not a problem,
+-- because it never returns.
+foreign import ccall "shutdownHaskellAndExit" unsafe primExit :: Int -> IO ()
 
 exitFailure :: IO a
 exitFailure = exitWith (ExitFailure 1)
@@ -188,13 +191,29 @@ unpackProgName argv
 --
 -- Suitable for use with Hugs 98
 -----------------------------------------------------------------------------
+import PrelPrim ( primGetRawArgs
+               , primGetEnv
+               , prelCleanupAfterRunAction
+               , copy_String_to_cstring
+               , readIORef
+               , nh_stderr
+               , nh_stdout
+               , nh_stdin 
+               , nh_exitwith 
+               , nh_flush
+               , nh_close
+               , nh_system
+               , nh_free
+               , nh_getPID
+               )
+
 
 data ExitCode = ExitSuccess | ExitFailure Int
                 deriving (Eq, Ord, Read, Show)
 
 getArgs                     :: IO [String]
 getArgs                      = primGetRawArgs >>= \rawargs ->
-                               return (drop 1 (dropWhile (/= "--") rawargs))
+                               return (tail rawargs)
 
 getProgName                 :: IO String
 getProgName                  = primGetRawArgs >>= \rawargs ->