aboutsummaryrefslogtreecommitdiffstats
path: root/ftp.c
diff options
context:
space:
mode:
authorDai Sato <satodai@w3m.jp>2007-05-23 15:06:05 +0000
committerDai Sato <satodai@w3m.jp>2007-05-23 15:06:05 +0000
commit3c7e9b27c1db068e9b29e5ffa3a74dea449a0c9a (patch)
tree3aa5dcb2c9d7db6bc81a56a82c160e5a93173071 /ftp.c
parentfix comments. (diff)
downloadw3m-3c7e9b27c1db068e9b29e5ffa3a74dea449a0c9a.tar.gz
w3m-3c7e9b27c1db068e9b29e5ffa3a74dea449a0c9a.zip
[w3m-dev 04155] fix for minpw.
Diffstat (limited to '')
-rw-r--r--ftp.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/ftp.c b/ftp.c
index 0ebb930..ce4ae19 100644
--- a/ftp.c
+++ b/ftp.c
@@ -1,6 +1,8 @@
-/* $Id: ftp.c,v 1.37 2006/04/07 13:21:11 inu Exp $ */
+/* $Id: ftp.c,v 1.38 2007/05/23 15:06:05 inu Exp $ */
#include <stdio.h>
+#ifndef __MINGW32_VERSION
#include <pwd.h>
+#endif /* __MINGW32_VERSION */
#include <Str.h>
#include <signal.h>
#include <setjmp.h>
@@ -14,10 +16,14 @@
#include <malloc.h>
#endif /* DEBUG */
+#ifndef __MINGW32_VERSION
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
+#else
+#include <winsock.h>
+#endif /* __MINGW32_VERSION */
typedef struct _FTP {
char *host;
@@ -371,7 +377,14 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
term_cbreak();
}
else {
+#ifndef __MINGW32_VERSION
pwd = Strnew_charp((char *)getpass("Password: "));
+#else
+ term_raw();
+ pwd = Strnew_charp(inputLine("Password: ", NULL, IN_PASSWORD));
+ pwd = Str_conv_to_system(pwd);
+ term_cbreak();
+#endif /* __MINGW32_VERSION */
}
add_auth_cookie_flag = TRUE;
}
@@ -380,8 +393,12 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
else if (ftppasswd != NULL && *ftppasswd != '\0')
pass = ftppasswd;
else {
+#ifndef __MINGW32_VERSION
struct passwd *mypw = getpwuid(getuid());
tmp = Strnew_charp(mypw ? mypw->pw_name : "anonymous");
+#else
+ tmp = Strnew_charp("anonymous");
+#endif __MINGW32_VERSION
Strcat_char(tmp, '@');
pass = tmp->ptr;
}