[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:45:44 UTC 2010
The following commit has been merged in the master branch:
commit 4ca3b9adf8783061f7b30ef926d03eb0f8dda1cb
Author: John Goerzen <jgoerzen at complete.org>
Date: Sun Oct 24 08:55:47 2004 +0100
Initial completeion of downloads
Keywords:
(jgoerzen at complete.org--projects/missingh--head--1.0--patch-114)
diff --git a/ChangeLog b/ChangeLog
index 23d7d30..9080c58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
#
+2004-10-24 02:55:47 GMT John Goerzen <jgoerzen at complete.org> patch-114
+
+ Summary:
+ Initial completeion of downloads
+ Revision:
+ missingh--head--1.0--patch-114
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Network/FTP/Client.hs
+
+
2004-10-24 02:43:11 GMT John Goerzen <jgoerzen at complete.org> patch-113
Summary:
diff --git a/libsrc/MissingH/Network/FTP/Client.hs b/libsrc/MissingH/Network/FTP/Client.hs
index ab0bbbf..64b6fe2 100644
--- a/libsrc/MissingH/Network/FTP/Client.hs
+++ b/libsrc/MissingH/Network/FTP/Client.hs
@@ -48,14 +48,22 @@ Useful standards:
-}
-module MissingH.Network.FTP.Client(easyConnectTo, connectTo,
- loginAnon, login,
+module MissingH.Network.FTP.Client(-- * Establishing/Removing connections
+ easyConnectTo, connectTo,
+ loginAnon, login, quit,
+ -- * Configuration
setPassive,
- nlst, dir, rename,
- delete, cwd, size, quit,
- mkdir, rmdir, pwd,
+ -- * Directory listing
+ nlst, dir,
+ -- * File downloads
+ getlines, getbinary,
+ -- * File manipulation
+ rename, delete, size,
+ -- * Directory manipulation
+ cwd, mkdir, rmdir, pwd,
+ -- * Low-level advanced commands
FTPConnection(isPassive),
- transfercmd, ntransfercmd,
+ transfercmd, ntransfercmd
)
where
import MissingH.Network.FTP.Parser
@@ -195,7 +203,8 @@ transfercmd :: FTPConnection -> String -> IO Handle
transfercmd h cmd = do x <- ntransfercmd h cmd
return (fst x)
-{- | Retrieves lines of data from the remote. -}
+{- | Retrieves lines of data from the remote. The string gives
+the command to issue. -}
retrlines :: FTPConnection -> String -> IO ([String], FTPResult)
retrlines h cmd =
-- foo returns the empty last item and closes the handle when done
@@ -211,6 +220,29 @@ retrlines h cmd =
c <- hGetContents newh
foo newh (split "\r\n" $ c)
+{- | Retrieves binary data from the remote. The string gives the command
+to issue. -}
+retrbinary :: FTPConnection -> String -> IO (String, FTPResult)
+retrbinary h cmd =
+ let foo h2 [] = do hClose h2
+ r <- getresp h
+ return ([], r)
+ foo h2 (x:xs) = do next <- unsafeInterleaveIO $ foo h2 xs
+ return $ (x : fst next, snd next)
+ in do
+ sendcmd h "TYPE I"
+ newh <- transfercmd h cmd
+ c <- hGetContents newh
+ foo newh c
+
+{- | Retrieves the specified file in text mode. -}
+getlines :: FTPConnection -> String -> IO ([String], FTPResult)
+getlines h fn = retrlines h ("RETR " ++ fn)
+
+{- | Retrieves the specified file in binary mode. -}
+getbinary :: FTPConnection -> String -> IO (String, FTPResult)
+getbinary h fn = retrbinary h ("RETR " ++ fn)
+
{- | Retrieves a list of files in the given directory.
FIXME: should this take a list of dirs? -}
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list