projects
/
oftp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
curses
[oftp]
/
src
/
ftp.c
diff --git
a/src/ftp.c
b/src/ftp.c
index
46fad28
..
262140d
100644
(file)
--- a/
src/ftp.c
+++ b/
src/ftp.c
@@
-1,5
+1,6
@@
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@
-8,6
+9,11
@@
#include "ftp.h"
#include "util.h"
#include "ftp.h"
#include "util.h"
+#ifdef __unix__
+#include <unistd.h>
+#define closesocket(s) close(s)
+#endif
+
struct ftp *ftp_alloc(void)
{
struct ftp *ftp;
struct ftp *ftp_alloc(void)
{
struct ftp *ftp;
@@
-44,8
+50,9
@@
int ftp_connect(struct ftp *ftp, const char *hostname, int port)
return -1;
}
return -1;
}
+ memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = inet_addr(host->h_addr);
+ addr.sin_addr = *((struct in_addr*)host->h_addr);
addr.sin_port = htons(port);
if(connect(ftp->ctl, (struct sockaddr*)&addr, sizeof addr) == -1) {
addr.sin_port = htons(port);
if(connect(ftp->ctl, (struct sockaddr*)&addr, sizeof addr) == -1) {
@@
-54,7
+61,6
@@
int ftp_connect(struct ftp *ftp, const char *hostname, int port)
ftp->ctl = -1;
return -1;
}
ftp->ctl = -1;
return -1;
}
-
return 0;
}
return 0;
}