diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-22 16:16:18 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-22 16:16:18 +0000 |
commit | 3f25d8f04868a17875fecef8d918cda4f9c3fbbe (patch) | |
tree | 21a352480fd81597d828fca9b0d94567059ce0b0 | |
parent | fix indent (diff) | |
download | w3m-3f25d8f04868a17875fecef8d918cda4f9c3fbbe.tar.gz w3m-3f25d8f04868a17875fecef8d918cda4f9c3fbbe.zip |
[w3m-dev 03677] view source, edit source
* buffer.c (discardBuffer): unlink header source
* file.c (loadFile): delete skip header
* fm.h (BP_SOURCE): deleted
(SkipHeader): deleted
* main (editBf): cleanup
(vmSrc): cleanup
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | buffer.c | 4 | ||||
-rw-r--r-- | file.c | 9 | ||||
-rw-r--r-- | fm.h | 4 | ||||
-rw-r--r-- | main.c | 101 |
5 files changed, 34 insertions, 96 deletions
@@ -1,5 +1,15 @@ 2003-01-23 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03677] view source, edit source + * buffer.c (discardBuffer): unlink header source + * file.c (loadFile): delete skip header + * fm.h (BP_SOURCE): deleted + (SkipHeader): deleted + * main (editBf): cleanup + (vmSrc): cleanup + +2003-01-23 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03676] cleanup for pipe * etc.c (open_pipe_rw): added * file.c (uncompress_stream): rewrite using open_pipe_rw @@ -6700,4 +6710,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.703 2003/01/22 16:10:27 ukai Exp $ +$Id: ChangeLog,v 1.704 2003/01/22 16:16:18 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.18 2003/01/10 16:11:01 ukai Exp $ */ +/* $Id: buffer.c,v 1.19 2003/01/22 16:16:19 ukai Exp $ */ #include "fm.h" #ifdef USE_MOUSE @@ -102,6 +102,8 @@ discardBuffer(Buffer *buf) if (buf->real_scheme != SCM_LOCAL || buf->bufferprop & BP_FRAME) unlink(buf->sourcefile); } + if (buf->header_source) + unlink(buf->header_source); if (buf->mailcap_source) unlink(buf->mailcap_source); while (buf->frameset) { @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.199 2003/01/22 16:11:03 ukai Exp $ */ +/* $Id: file.c,v 1.200 2003/01/22 16:16:20 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -497,8 +497,6 @@ loadFile(char *path) if (uf.stream == NULL) return NULL; buf = newBuffer(INIT_BUFFER_WIDTH); - if (SkipHeader) - readHeader(&uf, buf, TRUE, NULL); current_content_length = 0; #ifdef JP_CHARSET content_charset = '\0'; @@ -1955,11 +1953,6 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, if (real_type == NULL) real_type = t; - if (SkipHeader) { - if (t_buf == NULL) - t_buf = newBuffer(INIT_BUFFER_WIDTH); - readHeader(&f, t_buf, TRUE, NULL); - } proc = loadBuffer; #ifdef USE_IMAGE cur_baseURL = New(ParsedURL); @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.104 2003/01/20 15:24:19 ukai Exp $ */ +/* $Id: fm.h,v 1.105 2003/01/22 16:16:20 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -172,7 +172,6 @@ void bzero(void *, int); #define BP_NORMAL 0x0 #define BP_PIPE 0x1 #define BP_FRAME 0x2 -#define BP_SOURCE 0x4 #define BP_INTERNAL 0x8 #define BP_NO_URL 0x10 #define BP_REDIRECTED 0x20 @@ -766,7 +765,6 @@ global char InnerCode init(CODE_INNER_EUC); /* use EUC-JP internally; do not cha #endif /* JP_CHARSET */ global char SearchHeader init(FALSE); -global char SkipHeader init(FALSE); global char *DefaultType init(NULL); global char RenderFrame init(FALSE); global char TargetSelf init(FALSE); @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.196 2003/01/22 15:56:50 ukai Exp $ */ +/* $Id: main.c,v 1.197 2003/01/22 16:16:20 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -2471,10 +2471,6 @@ void editBf(void) { char *fn = Currentbuf->filename; - Buffer *buf, *fbuf = NULL, sbuf; -#ifdef JP_CHARSET - char old_code; -#endif Str cmd; if (fn == NULL || Currentbuf->pagerSource != NULL || /* Behaving as a pager */ @@ -2484,9 +2480,6 @@ editBf(void) disp_err_message("Can't edit other than local file", TRUE); return; } - if (Currentbuf->frameset != NULL) - fbuf = Currentbuf->linkBuffer[LB_FRAME]; - copyBuffer(&sbuf, Currentbuf); if (Currentbuf->edit) cmd = unquote_mailcap(Currentbuf->edit, Currentbuf->real_type, fn, checkHeader(Currentbuf, "Content-Type:"), NULL); @@ -2496,42 +2489,8 @@ editBf(void) system(cmd->ptr); fmInit(); -#ifdef JP_CHARSET - old_code = DocumentCode; - DocumentCode = Currentbuf->document_code; -#endif - SearchHeader = Currentbuf->search_header; - DefaultType = Currentbuf->real_type; - buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL); -#ifdef JP_CHARSET - DocumentCode = old_code; -#endif - SearchHeader = FALSE; - DefaultType = NULL; - - if (buf == NULL) { - disp_err_message("Re-loading failed", FALSE); - buf = nullBuffer(); - } - else if (buf == NO_BUFFER) { - buf = nullBuffer(); - } - if (fbuf != NULL) - Firstbuf = deleteBuffer(Firstbuf, fbuf); - repBuffer(Currentbuf, buf); - if ((buf->type != NULL) && (sbuf.type != NULL) && - ((!strcasecmp(buf->type, "text/plain") && - !strcasecmp(sbuf.type, "text/html")) || - (!strcasecmp(buf->type, "text/html") && - !strcasecmp(sbuf.type, "text/plain")))) { - vwSrc(); - if (Currentbuf != buf) - Firstbuf = deleteBuffer(Firstbuf, buf); - } - Currentbuf->search_header = sbuf.search_header; - if (Currentbuf->firstLine) - restorePosition(Currentbuf, &sbuf); displayBuffer(Currentbuf, B_FORCE_REDRAW); + reload(); } /* Run editor on the current screen */ @@ -4393,7 +4352,6 @@ curURL(void) void vwSrc(void) { - char *fn; Buffer *buf; if (Currentbuf->type == NULL || Currentbuf->bufferprop & BP_FRAME) @@ -4414,78 +4372,55 @@ vwSrc(void) return; saveBuffer(Currentbuf, f); fclose(f); - fn = tmpf->ptr; - Currentbuf->sourcefile = fn; + Currentbuf->sourcefile = tmpf->ptr; } else { return; } } - else if (Currentbuf->real_scheme == SCM_LOCAL && - !(Currentbuf->real_type && - !strcasecmp(Currentbuf->real_type, "local:directory"))) { - fn = Currentbuf->filename; - } - else { - fn = Currentbuf->sourcefile; - } + + buf = newBuffer(INIT_BUFFER_WIDTH); + if (!strcasecmp(Currentbuf->type, "text/html")) { -#ifdef JP_CHARSET - char old_code = DocumentCode; - DocumentCode = Currentbuf->document_code; -#endif - SkipHeader = Currentbuf->search_header; - buf = loadFile(fn); -#ifdef JP_CHARSET - DocumentCode = old_code; -#endif - SkipHeader = FALSE; - if (buf == NULL) - return; - buf->search_header = Currentbuf->search_header; buf->type = "text/plain"; if (Currentbuf->real_type && !strcasecmp(Currentbuf->real_type, "text/html")) buf->real_type = "text/plain"; else buf->real_type = Currentbuf->real_type; - buf->bufferprop |= BP_SOURCE; buf->buffername = Sprintf("source of %s", Currentbuf->buffername)->ptr; buf->linkBuffer[LB_N_SOURCE] = Currentbuf; Currentbuf->linkBuffer[LB_SOURCE] = buf; } else if (!strcasecmp(Currentbuf->type, "text/plain")) { - SkipHeader = Currentbuf->search_header; - DefaultType = "text/html"; - buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL); - SkipHeader = FALSE; - DefaultType = NULL; - if (buf == NULL || buf == NO_BUFFER) - return; - buf->search_header = Currentbuf->search_header; + buf->type = "text/html"; if (Currentbuf->real_type && !strcasecmp(Currentbuf->real_type, "text/plain")) buf->real_type = "text/html"; else buf->real_type = Currentbuf->real_type; - if (!strcmp(buf->buffername, conv_from_system(lastFileName(fn)))) - buf->buffername = - Sprintf("HTML view of %s", Currentbuf->buffername)->ptr; + buf->buffername = Sprintf("HTML view of %s", + Currentbuf->buffername)->ptr; buf->linkBuffer[LB_SOURCE] = Currentbuf; Currentbuf->linkBuffer[LB_N_SOURCE] = buf; -#ifdef USE_IMAGE - if (buf->img) - buf->need_reshape = TRUE; -#endif } else { return; } buf->currentURL = Currentbuf->currentURL; buf->real_scheme = Currentbuf->real_scheme; + buf->filename = Currentbuf->filename; buf->sourcefile = Currentbuf->sourcefile; + buf->header_source = Currentbuf->header_source; + buf->search_header = Currentbuf->search_header; +#ifdef JP_CHARSET + buf->document_code = Currentbuf->document_code; +#endif buf->clone = Currentbuf->clone; (*buf->clone)++; + + buf->need_reshape = TRUE; + reshapeBuffer(buf); pushBuffer(buf); displayBuffer(Currentbuf, B_NORMAL); } |