DragonFly On-Line Manual Pages

Search: Section:  


ftp_site(3)                     C Library Calls                    ftp_site(3)

NAME

ftp_site, ftp_site_open - perform a site-specific FTP operation

SYNOPSIS

#include <libfget.h> int ftp_site(FTP *ftp, char *fmt, ...); int ftp_site_open(FTPFILE **ftpfile, FTP *ftp, int mode, char *fmt, ...);

VERSION

This man page documents version 1.3 of libfget.

DESCRIPTION

The ftp_site() function executes an FTP "SITE" command on the FTP server associated with ftp. The ftp_site_open() function is used to execute a "SITE" command that opens a data connection. It creates a new FTPFILE handle for the new data connection and sets ftpfile to point to the newly created handle. The mode argument must be one of the following values: O_RDONLY The data connection is opened in read-only mode. O_WRONLY The data connection is opened in write-only mode. The FTPFILE handle returned in ftpfile may be used the same way as an FTPFILE handle returned by ftp_open(3). In other words, it can be passed to ftp_read(3) or ftp_write(3) to read or write data, and it must be freed by calling ftp_close(3) before another FTPFILE may be opened. For both functions, the fmt argument is a printf(3)-style format string. It, along with any optional arguments that may follow it, specifies the site command to be executed (i.e., the text sent to the FTP server after the "SITE" verb itself).

RETURN VALUE

The ftp_site() and ftp_site_open() functions return 0 on success, or -1 on error (and set errno).

ERRORS

The ftp_site() and ftp_site_open() functions fail if: ECONNRESET The server shut down the connection. The caller is then responsible for calling ftp_quit() with the FTP_QUIT_FAST flag set. ETIMEDOUT The operation timed out. (The timeout interval can be set via the FTP_OPT_IO_TIMEOUT option; see the ftp_set_options(3) man page for details.) EINVAL Unexpected response code received from server. EAGAIN An attempt was made to send a request to the server while the data connection is open. They may also fail for any of the errors specified for the underlying poll(2), read(2) or write(2) system calls. The ftp_site_open() function will also fail if: ENOSYS The mode argument was set to an unsupported value. It will also fail for any of the errors specified for the underlying socket(2), connect(2), fcntl(2) (using F_GETFL and F_SETFL), or calloc(3) system and library calls.

SEE ALSO

libfget(3), ftp_open(3) Feep Networks January 2004 ftp_site(3)

Search: Section: