ftp_opendir(3)

NAME
ftp_opendir, ftp_readdir, ftp_rewinddir, ftp_telldir, ftp_seekdir, ftp_closedir - FTP directory access functions

SYNOPSIS
#include <libfget.h> int ftp_opendir(FTPDIR **ftpdir, FTP *ftp, char *dir); int ftp_readdir(FTPDIR *ftpdir, struct ftpdirent *ftpdirent); void ftp_rewinddir(FTPDIR *ftpdir); off_t ftp_telldir(FTPDIR *ftpdir); void ftp_seekdir(FTPDIR *ftpdir, off_t loc); void ftp_closedir(FTPDIR *ftpdir);

VERSION
This man page documents version 1.2 of libfget.

DESCRIPTION
The ftp_opendir() function opens the directory dir on the FTP server associated with ftp. It allocates memory for an FTPDIR handle and changes ftpdir to point to the newly-allocated memory. The ftp_readdir() function writes a description of the next file in directory ftpdir to the structure pointed to by ftpdirent. The ftp_rewinddir() function resets ftpdir such that the next call to ftp_readdir() will return the first file in the directory. The ftp_telldir() function returns the current index into directory ftpdir. The ftp_seekdir() function sets the current index in directory ftpdir to loc. The ftp_closedir() function closes the directory handle and frees memory associated with ftpdir.

RETURN VALUE
The ftp_opendir() function returns 0 on success, or -1 on error (and sets errno). If errno is set to ECONNRESET, it indicates that the server shut down the connection. The caller is then responsible for calling ftp_quit() with the FTP_FASTCLOSE flag set. The ftp_readdir() function returns 1 when an entry is returned, or 0 at the end of the directory.

SEE ALSO
ftp_connect(3), opendir(3), readdir(3), rewinddir(3), seekdir(3), telldir(3), closedir(3)