aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-03-08 15:59:25 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-03-08 15:59:25 +0000
commit804cd482d6242e2a0522b5b4cb21d1c4688ead73 (patch)
tree9a7a4a76a67ff5ba216049b99109fcd4078fc98c /file.c
parent[w3m-dev 03090] Re: gopher broken (diff)
downloadw3m-804cd482d6242e2a0522b5b4cb21d1c4688ead73.tar.gz
w3m-804cd482d6242e2a0522b5b4cb21d1c4688ead73.zip
[w3m-dev 03093] Re: gopher broken
(Re: Bug#137287: w3m: segfault on gopher://xxxx.xxx URI) * file.c (loadGopherDir): fix ->ptr q should be url_quote() * url.c (openURL): url_unquote() for gopher selector From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat (limited to '')
-rw-r--r--file.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/file.c b/file.c
index d5a9782..1dc4419 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.76 2002/03/08 15:16:02 ukai Exp $ */
+/* $Id: file.c,v 1.77 2002/03/08 15:59:25 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -6201,7 +6201,7 @@ loadHTMLString(Str page)
* loadGopherDir: get gopher directory
*/
Buffer *
-loadGopherDir(URLFile *uf, Buffer * volatile newBuf)
+loadGopherDir(URLFile *uf, Buffer *volatile newBuf)
{
Str tmp, lbuf, name, file, host, port;
char code;
@@ -6215,10 +6215,10 @@ loadGopherDir(URLFile *uf, Buffer * volatile newBuf)
tmp = Strnew_charp("<pre>\n");
if (SETJMP(AbortLoading) != 0)
- goto gopher_end;
+ goto gopher_end;
prevtrap = signal(SIGINT, KeyAbort);
if (fmInitialized)
- term_cbreak();
+ term_cbreak();
#ifdef JP_CHARSET
if (newBuf->document_code != '\0')
@@ -6252,7 +6252,7 @@ loadGopherDir(URLFile *uf, Buffer * volatile newBuf)
if (!*q)
continue;
p = q + 1;
- for (q = p; *q && *q != '\t'&& *q != '\r' && *q != '\n'; q++) ;
+ for (q = p; *q && *q != '\t' && *q != '\r' && *q != '\n'; q++) ;
port = Strnew_charp_n(p, q - p);
switch (name->ptr[0]) {
@@ -6278,28 +6278,29 @@ loadGopherDir(URLFile *uf, Buffer * volatile newBuf)
p = "[unsupported]";
break;
}
- q = Strnew_m_charp("gopher://", host, ":", port, "/", file, NULL)->ptr;
- Strcat_m_charp(tmp, "<a href=\"", html_quote(q), "\">", p,
- html_quote(name->ptr + 1), "</a>\n", NULL);
- }
-
- gopher_end:
- if (fmInitialized)
- term_raw();
- signal(SIGINT, prevtrap);
-
- Strcat_charp(tmp, "</pre>\n");
-
- file = tmpfname(TMPF_SRC, ".html");
- src = fopen(file->ptr, "w");
- newBuf->sourcefile = file->ptr;
- pushText(fileToDelete, file->ptr);
-
- init_stream(&f, SCM_LOCAL, newStrStream(tmp));
- loadHTMLstream(&f, newBuf, src, TRUE);
- if (src)
- fclose(src);
-
+ q = Strnew_m_charp("gopher://", host->ptr, ":", port->ptr,
+ "/", file->ptr, NULL)->ptr;
+ Strcat_m_charp(tmp, "<a href=\"", url_quote(q), "\">", p,
+ html_quote(name->ptr + 1), "</a>\n", NULL);
+ }
+
+ gopher_end:
+ if (fmInitialized)
+ term_raw();
+ signal(SIGINT, prevtrap);
+
+ Strcat_charp(tmp, "</pre>\n");
+
+ file = tmpfname(TMPF_SRC, ".html");
+ src = fopen(file->ptr, "w");
+ newBuf->sourcefile = file->ptr;
+ pushText(fileToDelete, file->ptr);
+
+ init_stream(&f, SCM_LOCAL, newStrStream(tmp));
+ loadHTMLstream(&f, newBuf, src, TRUE);
+ if (src)
+ fclose(src);
+
#ifdef JP_CHARSET
newBuf->document_code = code;
#endif /* JP_CHARSET */
@@ -6458,16 +6459,16 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf)
tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image->url));
if (newBuf == NULL)
newBuf = newBuffer(INIT_BUFFER_WIDTH);
-/*
- if (frame_source) {
-*/
- tmpf = tmpfname(TMPF_SRC, ".html");
- src = fopen(tmpf->ptr, "w");
- newBuf->sourcefile = tmpf->ptr;
- pushText(fileToDelete, tmpf->ptr);
-/*
- }
-*/
+ /*
+ * if (frame_source) {
+ */
+ tmpf = tmpfname(TMPF_SRC, ".html");
+ src = fopen(tmpf->ptr, "w");
+ newBuf->sourcefile = tmpf->ptr;
+ pushText(fileToDelete, tmpf->ptr);
+ /*
+ * }
+ */
init_stream(&f, SCM_LOCAL, newStrStream(tmp));
loadHTMLstream(&f, newBuf, src, TRUE);
if (src)