aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-11 20:05:58 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-11 20:05:58 +0000
commitb9cf2cda0de67eaf433ea67ed666a1c5447df0a3 (patch)
treea1b401ac126f011a6d2d8fdf5b58fe426c70d466
parentrun make indent (diff)
downloadw3m-b9cf2cda0de67eaf433ea67ed666a1c5447df0a3.tar.gz
w3m-b9cf2cda0de67eaf433ea67ed666a1c5447df0a3.zip
[w3m-dev 02822] Print FTP directory list for -dump_extra option
From: Fumitoshi UKAI <ukai@debian.or.jp>
-rw-r--r--ChangeLog12
-rw-r--r--file.c20
-rw-r--r--ftp.c35
-rw-r--r--proto.h3
4 files changed, 52 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 74adb27..2b5dc6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-01-12 Fumitoshi UKAI <ukai@debian.or.jp>
+
+ * [w3m-dev 02822] Print FTP directory list for -dump_extra option
+ * file.c (loadGeneralFile): remove FTPDIRtmp, use readFTPDir() instead
+ save to buf->sourcefile for -dump_extra
+ * ftp.c (FTPDIRtmp): deleted
+ * ftp.c (openFTP): delete readFTPDir() part
+ * ftp.c (readFTPDir): added
+ * proto.h (readFTPDir): added
+
2002-01-11 Akinori Ito <aito@fw.ipsj.or.jp>
* [w3m-dev 02819]
@@ -1849,4 +1859,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.207 2002/01/11 02:24:13 a-ito Exp $
+$Id: ChangeLog,v 1.208 2002/01/11 20:05:58 ukai Exp $
diff --git a/file.c b/file.c
index 9710d14..615b412 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.39 2001/12/27 18:01:52 ukai Exp $ */
+/* $Id: file.c,v 1.40 2002/01/11 20:05:58 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -1018,23 +1018,35 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
/* openURL failure: it means either (1) the requested URL is a directory name
* on an FTP server, or (2) is a local directory name.
*/
- extern Str FTPDIRtmp;
if (fmInitialized && prevtrap) {
term_raw();
signal(SIGINT, prevtrap);
}
switch (f.scheme) {
case SCM_FTPDIR:
- if (FTPDIRtmp->length > 0) {
- b = loadHTMLString(FTPDIRtmp);
+ {
+ Str ftpdir = readFTPDir(&pu);
+ if (ftpdir && ftpdir->length > 0) {
+ FILE *src;
+ tmp = tmpfname(TMPF_SRC, ".html");
+ pushText(fileToDelete, tmp->ptr);
+ src = fopen(tmp->ptr, "w");
+ if (src) {
+ Strfputs(ftpdir, src);
+ fclose(src);
+ }
+ b = loadHTMLString(ftpdir);
if (b) {
if (b->currentURL.host == NULL
&& b->currentURL.file == NULL)
copyParsedURL(&b->currentURL, &pu);
b->real_scheme = pu.scheme;
+ if (src)
+ b->sourcefile = tmp->ptr;
}
return b;
}
+ }
break;
case SCM_LOCAL:
{
diff --git a/ftp.c b/ftp.c
index 46b564a..4c47d05 100644
--- a/ftp.c
+++ b/ftp.c
@@ -1,4 +1,4 @@
-/* $Id: ftp.c,v 1.9 2001/12/25 18:15:00 ukai Exp $ */
+/* $Id: ftp.c,v 1.10 2002/01/11 20:05:58 ukai Exp $ */
#include <stdio.h>
#include <pwd.h>
#include <Str.h>
@@ -374,8 +374,6 @@ FtpBye(FTP ftp)
}
-Str FTPDIRtmp;
-
static int ex_ftpdir_name_size_date(char *, char **, char **, char **);
static int ftp_system(FTP);
@@ -392,15 +390,9 @@ openFTP(ParsedURL *pu)
{
Str tmp2 = Strnew();
Str tmp3 = Strnew();
- Str host;
STATUS s;
- Str curdir;
char *user;
char *pass;
- char *fn;
- char *qdir;
- char **flist;
- int i, nfile, nfile_max = 100;
Str pwd = NULL;
int add_auth_cookie_flag;
char *realpathname = NULL;
@@ -408,7 +400,6 @@ openFTP(ParsedURL *pu)
char code = '\0', ic;
Str pathStr;
#endif
- int sv_type;
add_auth_cookie_flag = 0;
if (pu->user)
@@ -487,7 +478,26 @@ openFTP(ParsedURL *pu)
}
ftp_dir1:
pu->scheme = SCM_FTPDIR;
- FTPDIRtmp = Strnew();
+ return NULL;
+}
+
+Str
+readFTPDir(ParsedURL *pu)
+{
+ Str FTPDIRtmp = Strnew();
+ Str host;
+ Str curdir;
+ char *fn;
+ char *qdir;
+ char **flist;
+ int i, nfile, nfile_max = 100;
+ int sv_type;
+ STATUS s;
+ char *realpathname = NULL;
+ Str tmp2 = Strnew();
+
+ if (current_ftp->data == NULL)
+ return FTPDIRtmp;
sv_type = ftp_system(current_ftp);
if (pu->file == NULL || *pu->file == '\0') {
if (sv_type == UNIXLIKE_SERVER) {
@@ -499,6 +509,7 @@ openFTP(ParsedURL *pu)
curdir = Strnew_charp("/");
}
else {
+ realpathname = file_unquote(pu->file);
if (sv_type == UNIXLIKE_SERVER) {
s = FtpCwd(current_ftp, realpathname);
if (!FtpError(s)) {
@@ -656,7 +667,7 @@ openFTP(ParsedURL *pu)
FtpClose(current_ftp);
FtpBye(current_ftp);
- return NULL;
+ return FTPDIRtmp;
}
static int
diff --git a/proto.h b/proto.h
index fb19509..ed255df 100644
--- a/proto.h
+++ b/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.22 2001/12/26 18:29:33 ukai Exp $ */
+/* $Id: proto.h,v 1.23 2002/01/11 20:05:58 ukai Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -424,6 +424,7 @@ extern char *guessContentType(char *filename);
extern TextList *make_domain_list(char *domain_list);
extern int check_no_proxy(char *domain);
extern FILE *openFTP(ParsedURL *pu);
+extern Str readFTPDir(ParsedURL *pu);
extern void closeFTP(FILE * f);
extern int Ftpfclose(FILE * f);
extern AnchorList *putAnchor(AnchorList *al, char *url, char *target,