From e22f27ac866407213e0511e4d9ffbfc6983f222d Mon Sep 17 00:00:00 2001 From: jkh Date: Thu, 4 Jul 1996 00:55:21 +0000 Subject: Implement an ftpVerbose() hook. Submitted by: jmz --- lib/libftpio/ftpio.3 | 9 +++++++++ lib/libftpio/ftpio.c | 11 ++++++++++- lib/libftpio/ftpio.h | 4 +++- 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'lib/libftpio') diff --git a/lib/libftpio/ftpio.3 b/lib/libftpio/ftpio.3 index 89972f5..098ce3c 100644 --- a/lib/libftpio/ftpio.3 +++ b/lib/libftpio/ftpio.3 @@ -36,6 +36,7 @@ .Nm ftpPut , .Nm ftpBinary , .Nm ftpPassive , +.Nm ftpVerbose , .Nm ftpGetURL , .Nm ftpPutURL .Nd FTPIO User library @@ -61,6 +62,8 @@ .Fn ftpBinary "FILE *stream" .Ft int .Fn ftpPassive "FILE *stream, int status" +.Ft void +.Fn ftpVerbose "FILE *stream, int status" .Ft FILE * .Fn ftpGetURL "char *url, char *user, char *passwd" .Ft FILE * @@ -144,6 +147,12 @@ sets passive mode (for firewalls) for the current server connection named by to boolean value .Fa status . .Pp +.Fn ftpVerbose +sets the verbosity mode for the current server connection named by +.Fa stream +to boolean value +.Fa status . +.Pp .Fn ftpGetURL attempts to retreive the file named by the supplied .Fa URL diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c index 032eaa7..533c565 100644 --- a/lib/libftpio/ftpio.c +++ b/lib/libftpio/ftpio.c @@ -14,7 +14,7 @@ * Turned inside out. Now returns xfers as new file ids, not as a special * `state' of FTP_t * - * $Id: ftpio.c,v 1.6 1996/06/17 23:16:04 jkh Exp $ + * $Id: ftpio.c,v 1.7 1996/06/22 21:43:54 jkh Exp $ * */ @@ -139,6 +139,12 @@ ftpBinary(FILE *fp) ftp->is_binary = TRUE; return SUCCESS; } +void +ftpVerbose(FILE *fp, int status) +{ + FTP_t ftp = fcookie(fp); + ftp->is_verbose = status; +} int ftpChdir(FILE *fp, char *dir) @@ -360,6 +366,7 @@ ftp_new(void) ftp->con_state = init; ftp->is_binary = FALSE; ftp->is_passive = FALSE; + ftp->is_verbose = FALSE; ftp->errno = 0; return ftp; } @@ -448,6 +455,8 @@ get_a_line(FTP_t ftp) if (!i) continue; buf[i] = '\0'; + if (ftp->is_verbose == TRUE) + printf("%s\n",buf+4); return buf; } i++; diff --git a/lib/libftpio/ftpio.h b/lib/libftpio/ftpio.h index 47136b5..c6bb3d7 100644 --- a/lib/libftpio/ftpio.h +++ b/lib/libftpio/ftpio.h @@ -20,7 +20,7 @@ * Turned inside out. Now returns xfers as new file ids, not as a special * `state' of FTP_t * - * $Id: ftpio.h,v 1.3 1996/06/22 21:43:56 jkh Exp $ + * $Id: ftpio.h,v 1.4 1996/06/26 20:31:11 gpalmer Exp $ */ /* Internal housekeeping data structure for FTP sessions */ @@ -33,6 +33,7 @@ typedef struct { int errno; int is_binary; int is_passive; + int is_verbose; } *FTP_t; /* Exported routines - deal only with FILE* type */ @@ -45,6 +46,7 @@ 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); extern FILE *ftpPutURL(char *url, char *user, char *passwd); extern time_t ftpGetModtime(FILE *fp, char *s); -- cgit v1.1