[w3m-dev 03629] delete tmp file
* etc.c (tempfname): always file to delete * file.c (xface2xpm): no need fileToDelete (readHeader): ditto (loadGeneralFile): ditto (loadHTMLBuffer): ditto (loadHTMLString): ditto (loadGopherDir): ditto (loadImageBuffer): ditto (doExternal): rewrite (doFileSave): no need fileToDelete (uncompress_stream): ditto * fm.h (CurrentPid): added * image.c (getImage): cache->touch to delete * local.c (setLocalCookie): use CurrentPid (localcgi_post): fileToDelete * main.c (main): CurrentPid (pipeBuf): no need fileToDelete (query_from_followform): CurrentPid (vmSrc): no need fileToDelete From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||
|
||||
* [w3m-dev 03629] delete tmp file
|
||||
* etc.c (tempfname): always file to delete
|
||||
* file.c (xface2xpm): no need fileToDelete
|
||||
(readHeader): ditto
|
||||
(loadGeneralFile): ditto
|
||||
(loadHTMLBuffer): ditto
|
||||
(loadHTMLString): ditto
|
||||
(loadGopherDir): ditto
|
||||
(loadImageBuffer): ditto
|
||||
(doExternal): rewrite
|
||||
(doFileSave): no need fileToDelete
|
||||
(uncompress_stream): ditto
|
||||
* fm.h (CurrentPid): added
|
||||
* image.c (getImage): cache->touch to delete
|
||||
* local.c (setLocalCookie): use CurrentPid
|
||||
(localcgi_post): fileToDelete
|
||||
* main.c (main): CurrentPid
|
||||
(pipeBuf): no need fileToDelete
|
||||
(query_from_followform): CurrentPid
|
||||
(vmSrc): no need fileToDelete
|
||||
|
||||
2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||
|
||||
* [w3m-dev 03628] Re: Error occured while reset
|
||||
@@ -6286,4 +6309,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
||||
* release-0-2-1
|
||||
* import w3m-0.2.1
|
||||
|
||||
$Id: ChangeLog,v 1.666 2003/01/10 16:33:38 ukai Exp $
|
||||
$Id: ChangeLog,v 1.667 2003/01/10 16:42:14 ukai Exp $
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: etc.c,v 1.46 2002/12/27 16:09:18 ukai Exp $ */
|
||||
/* $Id: etc.c,v 1.47 2003/01/10 16:42:26 ukai Exp $ */
|
||||
#include "fm.h"
|
||||
#include <pwd.h>
|
||||
#include "myctype.h"
|
||||
@@ -7,11 +7,6 @@
|
||||
#include "hash.h"
|
||||
#include "terms.h"
|
||||
|
||||
#ifdef HAVE_GETCWD /* ??? ukai */
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#endif /* HAVE_GETCWD */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
|
||||
@@ -1517,7 +1512,8 @@ tmpfname(int type, char *ext)
|
||||
tmpf = Sprintf("%s/w3m%s%d-%d%s",
|
||||
rc_dir,
|
||||
tmpf_base[type],
|
||||
(int)getpid(), tmpf_seq[type]++, (ext) ? ext : "");
|
||||
CurrentPid, tmpf_seq[type]++, (ext) ? ext : "");
|
||||
pushText(fileToDelete, tmpf->ptr);
|
||||
return tmpf;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: file.c,v 1.181 2003/01/10 16:33:46 ukai Exp $ */
|
||||
/* $Id: file.c,v 1.182 2003/01/10 16:42:29 ukai Exp $ */
|
||||
#include "fm.h"
|
||||
#include <sys/types.h>
|
||||
#include "myctype.h"
|
||||
@@ -543,7 +543,6 @@ xface2xpm(char *xface)
|
||||
pclose(f);
|
||||
if (stat(xpm, &st))
|
||||
return NULL;
|
||||
pushText(fileToDelete, xpm);
|
||||
if (!st.st_size)
|
||||
return NULL;
|
||||
return xpm;
|
||||
@@ -579,7 +578,6 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
|
||||
|
||||
if (thru && !newBuf->header_source) {
|
||||
Str tmpf = tmpfname(TMPF_DFL, NULL);
|
||||
pushText(fileToDelete, tmpf->ptr);
|
||||
src = fopen(tmpf->ptr, "w");
|
||||
if (src)
|
||||
newBuf->header_source = tmpf->ptr;
|
||||
@@ -1537,7 +1535,6 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
||||
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);
|
||||
@@ -1593,7 +1590,6 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
||||
if (group && group->length > 0) {
|
||||
FILE *src;
|
||||
tmp = tmpfname(TMPF_SRC, ".html");
|
||||
pushText(fileToDelete, tmp->ptr);
|
||||
src = fopen(tmp->ptr, "w");
|
||||
if (src) {
|
||||
Strfputs(group, src);
|
||||
@@ -6091,7 +6087,6 @@ loadHTMLBuffer(URLFile *f, Buffer *newBuf)
|
||||
if (newBuf->sourcefile == NULL &&
|
||||
(f->scheme != SCM_LOCAL || newBuf->mailcap)) {
|
||||
tmp = tmpfname(TMPF_SRC, ".html");
|
||||
pushText(fileToDelete, tmp->ptr);
|
||||
src = fopen(tmp->ptr, "w");
|
||||
if (src)
|
||||
newBuf->sourcefile = tmp->ptr;
|
||||
@@ -6586,7 +6581,6 @@ loadHTMLString(Str page)
|
||||
|
||||
if (w3m_dump & DUMP_FRAME) {
|
||||
tmp = tmpfname(TMPF_SRC, ".html");
|
||||
pushText(fileToDelete, tmp->ptr);
|
||||
src = fopen(tmp->ptr, "w");
|
||||
if (src)
|
||||
newBuf->sourcefile = tmp->ptr;
|
||||
@@ -6713,7 +6707,6 @@ loadGopherDir(URLFile *uf, Buffer *volatile newBuf)
|
||||
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);
|
||||
@@ -6893,7 +6886,6 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf)
|
||||
tmpf = tmpfname(TMPF_SRC, ".html");
|
||||
src = fopen(tmpf->ptr, "w");
|
||||
newBuf->mailcap_source = tmpf->ptr;
|
||||
pushText(fileToDelete, tmpf->ptr);
|
||||
|
||||
init_stream(&f, SCM_LOCAL, newStrStream(tmp));
|
||||
loadHTMLstream(&f, newBuf, src, TRUE);
|
||||
@@ -7338,26 +7330,18 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
|
||||
struct mailcap *mcap;
|
||||
int mc_stat;
|
||||
Buffer *buf = NULL;
|
||||
char *header, *src = NULL;
|
||||
char *header, *src = NULL, *ext = uf.ext;
|
||||
|
||||
if (!(mcap = searchExtViewer(type)))
|
||||
return 0;
|
||||
|
||||
tmpf = tmpfname(TMPF_DFL, NULL);
|
||||
|
||||
if (mcap->nametemplate) {
|
||||
Str tmp =
|
||||
unquote_mailcap(mcap->nametemplate, NULL, tmpf->ptr, NULL, NULL);
|
||||
if (Strncmp(tmpf, tmp, tmpf->length) == 0) {
|
||||
tmpf = tmp;
|
||||
goto _save;
|
||||
}
|
||||
}
|
||||
if (uf.ext && *uf.ext) {
|
||||
Strcat_charp(tmpf, uf.ext);
|
||||
tmpf = unquote_mailcap(mcap->nametemplate, NULL, "", NULL, NULL);
|
||||
if (tmpf->ptr[0] == '.')
|
||||
ext = tmpf->ptr;
|
||||
}
|
||||
tmpf = tmpfname(TMPF_DFL, (ext && *ext) ? ext : NULL);
|
||||
|
||||
_save:
|
||||
if (IStype(uf.stream) != IST_ENCODED)
|
||||
uf.stream = newEncodedStream(uf.stream, uf.encoding);
|
||||
header = checkHeader(defaultbuf, "Content-Type:");
|
||||
@@ -7371,7 +7355,6 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
|
||||
}
|
||||
#endif
|
||||
|
||||
pushText(fileToDelete, tmpf->ptr);
|
||||
#ifdef HAVE_SETPGRP
|
||||
if (!(mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) &&
|
||||
!(mcap->flags & MAILCAP_NEEDSTERMINAL) && BackgroundExtViewer) {
|
||||
@@ -7543,7 +7526,6 @@ _doFileCopy(char *tmpf, char *defstr, int download)
|
||||
if (f)
|
||||
fclose(f);
|
||||
#endif
|
||||
pushText(fileToDelete, lock);
|
||||
flush_tty();
|
||||
pid = fork();
|
||||
if (!pid) {
|
||||
@@ -7646,7 +7628,6 @@ doFileSave(URLFile uf, char *defstr)
|
||||
if (f)
|
||||
fclose(f);
|
||||
#endif
|
||||
pushText(fileToDelete, lock);
|
||||
flush_tty();
|
||||
pid = fork();
|
||||
if (!pid) {
|
||||
@@ -7790,7 +7771,6 @@ uncompress_stream(URLFile *uf, char **src)
|
||||
|
||||
if (uf->scheme != SCM_LOCAL) {
|
||||
tmpf = tmpfname(TMPF_DFL, ext)->ptr;
|
||||
pushText(fileToDelete, tmpf);
|
||||
if (save2tmp(*uf, tmpf) < 0) {
|
||||
UFclose(uf);
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: fm.h,v 1.101 2003/01/10 16:08:22 ukai Exp $ */
|
||||
/* $Id: fm.h,v 1.102 2003/01/10 16:42:40 ukai Exp $ */
|
||||
/*
|
||||
* w3m: WWW wo Miru utility
|
||||
*
|
||||
@@ -829,6 +829,7 @@ global char *cgi_bin init(NULL);
|
||||
global char *index_file init(NULL);
|
||||
|
||||
global char *CurrentDir;
|
||||
global int CurrentPid;
|
||||
/*
|
||||
global Buffer *Currentbuf;
|
||||
global Buffer *Firstbuf;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: image.c,v 1.23 2002/12/11 15:08:47 ukai Exp $ */
|
||||
/* $Id: image.c,v 1.24 2003/01/10 16:42:46 ukai Exp $ */
|
||||
|
||||
#include "fm.h"
|
||||
#include <sys/types.h>
|
||||
@@ -518,8 +518,6 @@ getImage(Image * image, ParsedURL *current, int flag)
|
||||
cache->width = image->width;
|
||||
cache->height = image->height;
|
||||
putHash_sv(image_hash, key->ptr, (void *)cache);
|
||||
pushText(fileToDelete, cache->file);
|
||||
pushText(fileToDelete, cache->touch);
|
||||
}
|
||||
if (flag != IMG_FLAG_SKIP) {
|
||||
if (cache->loaded == IMG_FLAG_UNLOADED) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: local.c,v 1.16 2002/11/27 16:35:18 ukai Exp $ */
|
||||
/* $Id: local.c,v 1.17 2003/01/10 16:42:50 ukai Exp $ */
|
||||
#include "fm.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -30,7 +30,7 @@ setLocalCookie()
|
||||
char hostname[256];
|
||||
gethostname(hostname, 256);
|
||||
|
||||
Local_cookie = Sprintf("%d.%ld@%s", getpid(), lrand48(), hostname);
|
||||
Local_cookie = Sprintf("%d.%ld@%s", CurrentPid, lrand48(), hostname);
|
||||
set_environ("LOCAL_COOKIE", Local_cookie->ptr);
|
||||
}
|
||||
|
||||
@@ -400,7 +400,6 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer)
|
||||
f1 = fopen(tmp1->ptr, "w");
|
||||
if (f1 == NULL)
|
||||
return NULL;
|
||||
pushText(fileToDelete, tmp1->ptr);
|
||||
if ((pid = localcgi_popen_r(&f))) {
|
||||
fclose(f1);
|
||||
return pid > 0 ? f : NULL;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* $Id: main.c,v 1.188 2003/01/10 16:23:59 ukai Exp $ */
|
||||
/* $Id: main.c,v 1.189 2003/01/10 16:42:52 ukai Exp $ */
|
||||
#define MAINPROGRAM
|
||||
#include "fm.h"
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
|
||||
#include <sys/wait.h>
|
||||
@@ -380,6 +381,7 @@ main(int argc, char **argv, char **envp)
|
||||
load_argc = 0;
|
||||
|
||||
CurrentDir = currentdir();
|
||||
CurrentPid = (int)getpid();
|
||||
BookmarkFile = NULL;
|
||||
rc_dir = expandName(RC_DIR);
|
||||
i = strlen(rc_dir);
|
||||
@@ -1868,7 +1870,6 @@ pipeBuf(void)
|
||||
}
|
||||
saveBuffer(Currentbuf, f);
|
||||
fclose(f);
|
||||
pushText(fileToDelete, tmpf);
|
||||
buf = getpipe(myExtCommand(cmd, tmpf, TRUE)->ptr);
|
||||
if (buf == NULL) {
|
||||
disp_message("Execution failed", TRUE);
|
||||
@@ -3051,7 +3052,7 @@ query_from_followform(Str *query, FormItemList *fi, int multipart)
|
||||
}
|
||||
fi->parent->body = (*query)->ptr;
|
||||
fi->parent->boundary =
|
||||
Sprintf("------------------------------%d%ld%ld%ld", getpid(),
|
||||
Sprintf("------------------------------%d%ld%ld%ld", CurrentPid,
|
||||
fi->parent, fi->parent->body, fi->parent->boundary)->ptr;
|
||||
}
|
||||
*query = Strnew();
|
||||
@@ -4395,7 +4396,6 @@ vwSrc(void)
|
||||
!strcasecmp(Currentbuf->type, "text/plain")) {
|
||||
FILE *f;
|
||||
Str tmpf = tmpfname(TMPF_SRC, NULL);
|
||||
pushText(fileToDelete, tmpf->ptr);
|
||||
f = fopen(tmpf->ptr, "w");
|
||||
if (f == NULL)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user