From a9665b092b3dbdb723b5eb95c19cbc77a6c78562 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 14 Aug 2001 09:26:32 +0000 Subject: exchanged the second and third argument to fwrite(), as that makes it look good on VMS. Removed a '#if 0' section, made Curl_getmyhost static and cut off the 'Curl_' prefix --- lib/ftp.c | 123 ++------------------------------------------------------------ 1 file changed, 3 insertions(+), 120 deletions(-) (limited to 'lib') diff --git a/lib/ftp.c b/lib/ftp.c index 8aed1a809..6aace1d4b 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -252,7 +252,7 @@ int Curl_GetFTPResponse(int sockfd, /* output debug output if that is requested */ if(data->bits.verbose) { fputs("< ", data->err); - fwrite(line_start, 1, perline, data->err); + fwrite(line_start, perline, 1, data->err); /* no need to output LF here, it is part of the data */ } @@ -308,125 +308,8 @@ int Curl_GetFTPResponse(int sockfd, return nread; /* total amount of bytes read */ } -#if 0 -/* - * We allow the ftpcode pointer to be NULL if no reply integer is wanted - */ - -int Curl_GetFTPResponse(int sockfd, char *buf, - struct connectdata *conn, - int *ftpcode) -{ - int nread; - ssize_t keepon=TRUE; - size_t got; - char *ptr; - int timeout = 3600; /* in seconds */ - struct timeval interval; - fd_set rkeepfd; - fd_set readfd; - struct UrlData *data = conn->data; - -#define SELECT_OK 0 -#define SELECT_ERROR 1 -#define SELECT_TIMEOUT 2 - int error = SELECT_OK; - - if(ftpcode) - *ftpcode=0; /* 0 for errors */ - - if(data->timeout) { - /* if timeout is requested, find out how much remaining time we have */ - timeout = data->timeout - /* timeout time */ - (Curl_tvlong(Curl_tvnow()) - Curl_tvlong(conn->now)); /* spent time */ - if(timeout <=0 ) { - failf(data, "Transfer aborted due to timeout"); - return -SELECT_TIMEOUT; /* already too little time */ - } - } - - FD_ZERO (&readfd); /* clear it */ - FD_SET (sockfd, &readfd); /* read socket */ - - /* get this in a backup variable to be able to restore it on each lap in the - select() loop */ - rkeepfd = readfd; - - do { - ptr=buf; - - /* get us a full line, terminated with a newline */ - nread=0; - keepon=TRUE; - while((nreadbits.verbose && buf[0]) { - fputs("< ", data->err); - fwrite(buf, 1, nread, data->err); - fputs("\n", data->err); - } - } while(!error && - (nread<4 || !lastline(buf)) ); - - if(error) - return -error; - - if(ftpcode) - *ftpcode=atoi(buf); /* return the initial number like this */ - - return nread; -} -#endif - /* -- who are we? -- */ -char *Curl_getmyhost(char *buf, int buf_size) +static char *getmyhost(char *buf, int buf_size) { #if defined(HAVE_GETHOSTNAME) gethostname(buf, buf_size); @@ -1084,7 +967,7 @@ again:; } if(! *myhost) { h=Curl_gethost(data, - Curl_getmyhost(myhost, sizeof(myhost)), + getmyhost(myhost, sizeof(myhost)), &hostdataptr); } infof(data, "We connect from %s\n", myhost); -- cgit v1.2.3