From b9cf2cda0de67eaf433ea67ed666a1c5447df0a3 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Fri, 11 Jan 2002 20:05:58 +0000 Subject: [w3m-dev 02822] Print FTP directory list for -dump_extra option From: Fumitoshi UKAI --- file.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'file.c') 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 #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: { -- cgit v1.2.3