mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Fix formatting when tabs and spaces got mixed up (if tabstop was not set to
8 this looked quite funny :) Added a small formatting section for vim at the bottom, it also contains an emacs portion (copied it from another project I'm working on), I don't know if this is correct, but its a step (the vim part is correct :)
This commit is contained in:
parent
06993556f3
commit
08238f4320
28
lib/ftp.c
28
lib/ftp.c
@ -134,7 +134,7 @@ static CURLcode AllowServerConnect(struct SessionHandle *data,
|
||||
|
||||
sclose(sock); /* close the first socket */
|
||||
|
||||
if( -1 == s) {
|
||||
if (-1 == s) {
|
||||
/* DIE! */
|
||||
failf(data, "Error accept()ing server connect");
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
@ -187,8 +187,8 @@ int Curl_GetFTPResponse(int sockfd,
|
||||
#define SELECT_TIMEOUT 2
|
||||
int error = SELECT_OK;
|
||||
|
||||
if(ftpcode)
|
||||
*ftpcode=0; /* 0 for errors */
|
||||
if (ftpcode)
|
||||
*ftpcode = 0; /* 0 for errors */
|
||||
|
||||
if(data->set.timeout) {
|
||||
/* if timeout is requested, find out how much remaining time we have */
|
||||
@ -248,7 +248,7 @@ int Curl_GetFTPResponse(int sockfd,
|
||||
int i;
|
||||
|
||||
nread += gotbytes;
|
||||
for(i=0; i< gotbytes; ptr++, i++) {
|
||||
for(i = 0; i < gotbytes; ptr++, i++) {
|
||||
perline++;
|
||||
if(*ptr=='\n') {
|
||||
/* a newline is CRLF in ftp-talk, so the CR is ignored as
|
||||
@ -933,12 +933,14 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
if (getnameinfo((struct sockaddr *)&ss, sslen,
|
||||
portmsgbuf, sizeof(portmsgbuf), tmp, sizeof(tmp), niflags))
|
||||
continue;
|
||||
|
||||
/* do not transmit IPv6 scope identifier to the wire */
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
char *q = strchr(portmsgbuf, '%');
|
||||
if (q)
|
||||
*q = '\0';
|
||||
}
|
||||
|
||||
ftpsendf(conn->firstsocket, conn, "%s |%d|%s|%s|", *modep, eprtaf,
|
||||
portmsgbuf, tmp);
|
||||
} else if (strcmp(*modep, "LPRT") == 0 ||
|
||||
@ -957,26 +959,33 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < alen; i++) {
|
||||
if (portmsgbuf[0])
|
||||
snprintf(tmp, sizeof(tmp), ",%u", ap[i]);
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp), "%u", ap[i]);
|
||||
|
||||
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(*modep, "LPRT") == 0) {
|
||||
snprintf(tmp, sizeof(tmp), ",%d", plen);
|
||||
|
||||
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf))
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; i < plen; i++) {
|
||||
snprintf(tmp, sizeof(tmp), ",%u", pp[i]);
|
||||
|
||||
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ftpsendf(conn->firstsocket, conn, "%s %s", *modep, portmsgbuf);
|
||||
}
|
||||
|
||||
@ -1165,6 +1174,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
break;
|
||||
str++;
|
||||
}
|
||||
|
||||
if(!*str) {
|
||||
failf(data, "Couldn't interpret this 227-reply: %s", buf);
|
||||
return CURLE_FTP_WEIRD_227_FORMAT;
|
||||
@ -1228,6 +1238,7 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
snprintf(nbuf, sizeof(nbuf), "?");
|
||||
snprintf(sbuf, sizeof(sbuf), "?");
|
||||
}
|
||||
|
||||
if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
|
||||
NULL, 0, 0)) {
|
||||
infof(data, "Connecting to %s port %s\n", nbuf, sbuf);
|
||||
@ -1817,3 +1828,12 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 2
|
||||
* c-basic-offset: 2
|
||||
* End:
|
||||
* vim600: et sw=2 ts=2 sts=2 tw=78 fdm=marker
|
||||
* vim<600: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user