summaryrefslogtreecommitdiff
path: root/ftp.c
diff options
context:
space:
mode:
authorewt <devnull@localhost>1996-03-13 03:48:48 +0000
committerewt <devnull@localhost>1996-03-13 03:48:48 +0000
commit9d5800fe34ed41ff011deb2984150840070eae58 (patch)
tree93bb34eae2d56f09d94c902c05fd857cb9c994be /ftp.c
parent6ad0ce0b6f524856e8ef1866e3dc180059f2f528 (diff)
downloadlibrpm-tizen-9d5800fe34ed41ff011deb2984150840070eae58.tar.gz
librpm-tizen-9d5800fe34ed41ff011deb2984150840070eae58.tar.bz2
librpm-tizen-9d5800fe34ed41ff011deb2984150840070eae58.zip
added message() calls for debugging info
CVS patchset: 466 CVS date: 1996/03/13 03:48:48
Diffstat (limited to 'ftp.c')
-rw-r--r--ftp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ftp.c b/ftp.c
index e4d5decad..dbf22eedf 100644
--- a/ftp.c
+++ b/ftp.c
@@ -19,6 +19,7 @@
#define BUFFER_SIZE 4096
#include "ftp.h"
+#include "lib/messages.h"
static int ftpCheckResponse(int sock);
static int ftpCommand(int sock, char * command, ...);
@@ -162,6 +163,8 @@ int ftpOpen(char * host, char * name, char * password) {
destPort.sin_port = htons(IPPORT_FTP);
destPort.sin_addr = serverAddress;
+ message(MESS_DEBUG, "establishing connection\n");
+
if (connect(sock, (struct sockaddr *) &destPort, sizeof(destPort))) {
close(sock);
return -1;
@@ -185,6 +188,8 @@ int ftpOpen(char * host, char * name, char * password) {
strcat(password, "@");
}
+ message(MESS_DEBUG, "logging in\n");
+
if (ftpCommand(sock, "USER", name, NULL)) {
close(sock);
return -1;
@@ -200,6 +205,8 @@ int ftpOpen(char * host, char * name, char * password) {
return -1;
}
+ message(MESS_DEBUG, "logged into ftp site\n");
+
return sock;
}
@@ -288,12 +295,18 @@ int ftpGetFile(int sock, char * remotename, int dest) {
sprintf(numbuf, ",%d,%d", dataPort >> 8, dataPort & 0xFF);
strcat(portbuf, numbuf);
+ message(MESS_DEBUG, "sending PORT command\n");
+
if (ftpCommand(sock, "PORT", portbuf, NULL)) {
close(dataSocket);
return 1;
}
+ message(MESS_DEBUG, "sending RETR command\n");
+
if (ftpCommand(sock, "RETR", remotename, NULL)) {
+ message(MESS_DEBUG, "RETR command failed\n");
+
close(dataSocket);
return 1;
}
@@ -302,6 +315,8 @@ int ftpGetFile(int sock, char * remotename, int dest) {
trSocket = accept(dataSocket, (struct sockaddr *) &dataAddress, &i);
close(dataSocket);
+ message(MESS_DEBUG, "data socket open\n");
+
return ftpReadData(trSocket, dest);
}