DragonFly On-Line Manual Pages
ftp_stat(3) C Library Calls ftp_stat(3)
NAME
ftp_stat, ftp_lstat - get file status from an FTP server
SYNOPSIS
#include <libfget.h>
int ftp_stat(FTP *ftp, char *pathname, struct ftpstat *fsp);
int ftp_lstat(FTP *ftp, char *pathname, struct ftpstat *fsp);
VERSION
This man page documents version 1.3 of libfget.
DESCRIPTION
The ftp_stat() function writes a description of the file pathname on
the FTP server associated with ftp to the structure pointed to by fsp.
The ftp_lstat() function is the same as the ftp_stat() function, except
that it does not follow symbolic links.
Both functions set the following fields of the structure pointed to by
fsp:
mode_t fs_mode;
The file's mode.
nlink_t fs_nlink;
Number of hard links to the file. This will be set to 1 if not
provided by the server.
char fs_username[MAXUSERNAMELEN];
The name of the owner of the file. In some cases, this may be a
printable-ASCII representation of the user's uid instead of the
user's login. This will be set to the string "-1" if not
provided by the server.
char fs_groupname[MAXPATHLEN];
The name of the file's group. In some cases, this may be a
printable-ASCII representation of the group's gid instead of the
group's name. This will be set to the string "-1" if not
provided by the server.
off_t fs_size;
The size of the file.
time_t fs_mtime;
The modification time of the file. Note that this value may or
may not be in UTC, depending on the server.
dev_t fs_rdev;
The device ID, if the file is a character or block device.
RETURN VALUE
The ftp_stat() and ftp_lstat() functions return 0 on success, or -1 on
error (and set errno).
ERRORS
The ftp_stat() and ftp_lstat() 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.
ENOTDIR
A component of the path prefix is not a directory.
ELOOP Too many symlinks were traversed while locating the specified
path.
ENOENT The specified path does not exist.
They may also fail for any of the errors specified for the underlying
poll(2), read(2), write(2), socket(2), connect(2), fcntl(2) (using
F_GETFL and F_SETFL), shutdown(2), close(2), or calloc(3) system and
library calls.
NOTES
Because of the limitations of the FTP protocol, applications must not
rely on being able to call ftp_readlink() while an FTPFILE handle is
open. See libfget(3) for more information.
SEE ALSO
libfget(3), stat(2), lstat(2)
Feep Networks January 2004 ftp_stat(3)