aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-03-16 11:39:31 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-03-16 11:39:31 +0000
commitab057975009f2ba23117786461ce9d29a0d1a454 (patch)
tree798d7e908573815611af287921b80177137cf4c5
parent8629719e0e032d35d4d46fd018ca2f85e2f334fe (diff)
cleaned up some #ifdef mess, now uses data->fwrite() to write headers
-rw-r--r--lib/ftp.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index e3da49179..4af86fb48 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -244,13 +244,7 @@ static int GetLastResponse(int sockfd, char *buf,
char *getmyhost(void)
{
static char myhost[256];
-#if !defined(WIN32) && !defined(HAVE_UNAME) && !defined(HAVE_GETHOSTNAME)
- /* We have no means of finding the local host name! */
- strcpy(myhost, "localhost");
-#endif
-#if defined(WIN32) || !defined(HAVE_UNAME)
- gethostname(myhost, 256);
-#else
+#ifdef HAVE_UNAME
struct utsname ugnm;
if (uname(&ugnm) < 0)
@@ -259,6 +253,13 @@ char *getmyhost(void)
(void) strncpy(myhost, ugnm.nodename, 255);
myhost[255] = '\0';
#endif
+#ifdef HAVE_GETHOSTNAME
+ gethostname(myhost, 256);
+#endif
+#if !defined(HAVE_UNAME) && !defined(HAVE_GETHOSTNAME)
+ /* We have no means of finding the local host name! */
+ strcpy(myhost, "localhost");
+#endif
return myhost;
}
@@ -425,7 +426,8 @@ UrgError _ftp(struct UrlData *data,
}
if(data->writeheader) {
/* the header is requested to be written to this file */
- if(strlen(buf) != fwrite (buf, 1, strlen(buf), data->writeheader)) {
+ if(strlen(buf) != data->fwrite (buf, 1, strlen(buf),
+ data->writeheader)) {
failf (data, "Failed writing output");
return URG_WRITE_ERROR;
}
@@ -583,7 +585,7 @@ UrgError _ftp(struct UrlData *data,
struct hostent * answer;
unsigned long address;
-#if defined(HAVE_INET_ADDR) || defined(WIN32)
+#if defined(HAVE_INET_ADDR)
address = inet_addr(newhost);
answer = gethostbyaddr((char *) &address, sizeof(address),
AF_INET);