1 .\" Copyright (c) 1996 Jordan Hubbard (jkh@FreeBSD.org)
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $FreeBSD: src/lib/libftpio/ftpio.3,v 1.21.2.9 2002/12/29 16:35:35 schweikh Exp $
48 .Nd FTPIO user library
54 .Fn ftpLogin "const char *host" "const char *user" "const char *passwd" "int ftp_port" "int verbose" "int *retcode"
56 .Fn ftpChdir "FILE *stream" "char *dirname"
58 .Fn ftpErrno "FILE *stream"
60 .Fn ftpErrString "int errno"
62 .Fn ftpGetModtime "FILE *stream" "const char *file"
64 .Fn ftpGetSize "FILE *stream" "const char *file"
66 .Fn ftpGet "FILE *stream" "const char *file" "off_t *seekto"
68 .Fn ftpPut "FILE *stream" "const char *file"
70 .Fn ftpAscii "FILE *stream"
72 .Fn ftpBinary "FILE *stream"
74 .Fn ftpPassive "FILE *stream" "int status"
76 .Fn ftpVerbose "FILE *stream" "int status"
78 .Fn ftpGetURL "const char *url" "const char *user" "const char *passwd" "int *retcode"
80 .Fn ftpPutURL "const char *url" "const char *user" "const char *passwd" "int *retcode"
82 .Fn ftpLoginAf "const char *host" "int af" "const char *user" "const char *passwd" "int ftp_port" "int verbose" "int *retcode"
84 .Fn ftpGetURLAf "const char *url" "int af" "const char *user" "const char *passwd" "int *retcode"
86 .Fn ftpPutURLAf "const char *url" "int af" "const char *user" "const char *passwd" "int *retcode"
88 These functions implement a high-level library for managing FTP connections.
91 attempts to log in using the supplied
97 defaults to the standard ftp port of 21) and
99 fields. If it is successful, a
100 standard stream descriptor is returned which should be passed to
101 subsequent FTP operations.
102 On failure, NULL is returned and
104 will have the error code returned by the foreign server.
107 attempts to issue a server CD command to the directory named in
109 On success, zero is returned. On failure, the error code from the server.
112 returns the server failure code for the last operation (useful for seeing
113 more about what happened if you're familiar with FTP error codes).
115 returns a human readable version of the supplied server failure code.
118 attempts to retrieve the file named by the
120 argument (which is assumed to be relative to the FTP server's current directory,
123 and returns a new FILE* pointer for the file or NULL on failure. If
125 is non-NULL, the contents of the integer it points to will be used
126 as a restart point for the file, that is to say that the stream
129 bytes into the file gotten (this is handy for restarting failed
130 transfers efficiently). If the seek operation fails, the value
136 returns the last modification time of the file named by the
138 argument. If the file could not be opened or stat'd, 0 is returned.
141 returns the size in bytes of the file named by the
143 argument. If the file could not be opened or stat'd, -1 is returned.
146 attempts to create a new file named by the
148 argument (which is assumed to be relative to the FTP server's current directory,
153 pointer for the file or NULL on failure.
156 sets ASCII mode for the current server connection named by
160 sets binary mode for the current server connection named by
164 sets passive mode (for firewalls) for the current server connection named by
170 sets the verbosity mode for the current server connection named by
176 attempts to retrieve the file named by the supplied
178 and can be considered equivalent to the combined
183 operations except that no server
185 is ever returned - the connection to the server closes when
186 the file has been completely read. Use the lower-level routines
187 if multiple gets are required as it will be far more efficient.
190 attempts to create the file named by the supplied
192 and can be considered equivalent to the combined
197 operations except that no server stream is ever returned - the connection
198 to the server closes when the file has been completely written. Use the
199 lower-level routines if multiple puts are required as it will be far more
209 except that they are able to specify address family
212 .Bl -tag -width FTP_PASSIVE_MODE -offset 3n
214 Maximum time, in seconds, to wait for a response
215 from the peer before aborting an
218 .It Ev FTP_PASSIVE_MODE
219 If defined, forces the use of passive mode, unless equal
220 to ``NO'' or ``no'' in which case active mode is forced.
221 If defined, the setting of this variable always overrides any calls to
225 Started life as Poul-Henning Kamp's ftp driver for the system installation
226 utility, later significantly mutated into a more general form as an
227 extension of stdio by Jordan Hubbard. Also incorporates some ideas and
228 extensions from Jean-Marc Zucconi.
231 .An Poul-Henning Kamp
233 .An Jean-Marc Zucconi
235 I'm sure you can get this thing's internal state machine confused if
236 you really work at it, but so far it's proven itself pretty robust in