1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/lib/libftpio/ftpio.h
Andrey A. Chernov 0c663b7771 For functions ftpGetURL, ftpPutURL, ftpLogin it was impossible to know
FTP error return code because
1) They return NULL, it means that ftpErrno can't be used because
it takes file pointer
2) They don't have FILE-type argument as f.e. ftpGet/ftpPut to use
it for ftpErrno instead.

For that functions I add yet one int* type argument to store
FTP error return code. It is impossible to add some global variable
for that reason, because user can have multiply FTP connections
opened at the same time.

So, interface changed, major number bumped.
Userland changes will follows.

Minor bugfixes, the code:
Forget to close file in few places, when failure occurse
Forget to NULL cached host name, multiply free is possible
1996-11-14 06:59:41 +00:00

65 lines
2.0 KiB
C

#ifndef _FTP_H_INCLUDE
#define _FTP_H_INCLUDE
#include <sys/types.h>
#include <stdio.h>
#include <time.h>
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* Major Changelog:
*
* Jordan K. Hubbard
* 17 Jan 1996
*
* Turned inside out. Now returns xfers as new file ids, not as a special
* `state' of FTP_t
*
* $Id: ftpio.h,v 1.9 1996/11/14 05:22:12 ache Exp $
*/
/* Internal housekeeping data structure for FTP sessions */
typedef struct {
enum { init, isopen, quit } con_state;
int fd_ctrl;
int addrtype;
char *host;
char *file;
int errno;
int is_binary;
int is_passive;
int is_verbose;
} *FTP_t;
/* Structure we use to match FTP error codes with readable strings */
struct ftperr {
const int num;
const char *string;
};
extern struct ftperr ftpErrList[];
extern int const ftpErrListLength;
/* Exported routines - deal only with FILE* type */
extern FILE *ftpLogin(char *host, char *user, char *passwd, int port, int verbose, int *retcode);
extern int ftpChdir(FILE *fp, char *dir);
extern int ftpErrno(FILE *fp);
extern off_t ftpGetSize(FILE *fp, char *file);
extern FILE *ftpGet(FILE *fp, char *file, off_t *seekto);
extern FILE *ftpPut(FILE *fp, char *file);
extern int ftpAscii(FILE *fp);
extern int ftpBinary(FILE *fp);
extern int ftpPassive(FILE *fp, int status);
extern void ftpVerbose(FILE *fp, int status);
extern FILE *ftpGetURL(char *url, char *user, char *passwd, int *retcode);
extern FILE *ftpPutURL(char *url, char *user, char *passwd, int *retcode);
extern time_t ftpGetModtime(FILE *fp, char *s);
extern const char *ftpErrString(int errno);
#endif /* _FTP_H_INCLUDE */