[project @ 2003-07-22 09:55:05 by ross]
[haskell-directory.git] / System / Posix / Internals.hs
index aac0997..931aec2 100644 (file)
@@ -43,6 +43,8 @@ import System.IO
 
 #ifdef __HUGS__
 import Hugs.Prelude (IOException(..), IOErrorType(..))
+
+{-# CBITS PrelIOUtils.c dirUtils.c #-}
 #endif
 
 -- ---------------------------------------------------------------------------
@@ -265,13 +267,13 @@ getEcho fd = do
    then ioException (ioe_unk_error "getEcho" "failed to get echoing")
    else return (r == 1)
 
-foreign import ccall unsafe "HsBase.h consUtils.h set_console_buffering__"
+foreign import ccall unsafe "consUtils.h set_console_buffering__"
    set_console_buffering :: CInt -> CInt -> IO CInt
 
-foreign import ccall unsafe "HsBase.h consUtils.h set_console_echo__"
+foreign import ccall unsafe "consUtils.h set_console_echo__"
    set_console_echo :: CInt -> CInt -> IO CInt
 
-foreign import ccall unsafe "HsBase.h consUtils.h get_console_echo__"
+foreign import ccall unsafe "consUtils.h get_console_echo__"
    get_console_echo :: CInt -> IO CInt
 
 #endif
@@ -352,7 +354,7 @@ foreign import ccall unsafe "HsBase.h read"
 foreign import ccall unsafe "HsBase.h readdir" 
    c_readdir :: Ptr CDir -> IO (Ptr CDirent)
 
-foreign import ccall unsafe "HsBase.h rename"
+foreign import ccall unsafe "dirUtils.h __hscore_renameFile"
    c_rename :: CString -> CString -> IO CInt
                     
 foreign import ccall unsafe "HsBase.h rewinddir"
@@ -436,6 +438,19 @@ foreign import ccall unsafe "HsBase.h _setmode"
 --      printf( "'stdin' successfully changed to binary mode\n" );
 #endif
 
+-- traversing directories
+foreign import ccall unsafe "dirUtils.h __hscore_readdir"
+  readdir  :: Ptr CDir -> Ptr (Ptr CDirent) -> IO CInt
+foreign import ccall unsafe "HsBase.h __hscore_free_dirent"
+  freeDirEnt  :: Ptr CDirent -> IO ()
+foreign import ccall unsafe "HsBase.h __hscore_end_of_dir"
+  end_of_dir :: CInt
+foreign import ccall unsafe "HsBase.h __hscore_d_name"
+  d_name :: Ptr CDirent -> IO CString
+
 -- POSIX flags only:
 foreign import ccall unsafe "HsBase.h __hscore_o_rdonly" o_RDONLY :: CInt
 foreign import ccall unsafe "HsBase.h __hscore_o_wronly" o_WRONLY :: CInt