ftp_closedir man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

ftp_opendir(3)			C Library Calls			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.3 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  mem‐
       ory associated with ftpdir.

RETURN VALUE
       The  ftp_opendir()  function  returns 0 on success, or -1 on error (and
       sets errno).

       The ftp_readdir() function returns 1 when an entry is returned, or 0 at
       the end of the directory.  It cannot fail.

       The  ftp_telldir()  function  returns  the  requested index.  It cannot
       fail.

ERRORS
       The ftp_opendir() function fails if:

       ECONNRESET
	      The server shut down the connection.  The caller is then respon‐
	      sible 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.

       It 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_opendir() while  an  FTPFILE  handle  is
       open.  See libfget(3) for more information.

EXAMPLE
       The following code shows how to read a directory from an FTP server:

	      FTP *ftp;
	      FTPDIR *ftpdir;
	      struct ftpdirent fde;

	      /* ... call ftp_connect(3) and ftp_login(3) ... */

	      if (ftp_opendir(&ftpdir, ftp, "/path/to/directory") == -1)
	      {
		   perror("ftp_opendir()");
		   exit(1);
	      }

	      while (ftp_readdir(ftpdir, &fde))
	      {
		   puts(fde.fd_name);
	      }

	      ftp_closedir(ftpdir);

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

Feep Networks			 January 2004			ftp_opendir(3)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net