Merge pull request #219 from rkta/add_option_for_temp_files
Add option to set directory for temporary files
This commit is contained in:
@@ -1702,7 +1702,7 @@ url_unquote_conv0(char *url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *tmpf_base[MAX_TMPF_TYPE] = {
|
static char *tmpf_base[MAX_TMPF_TYPE] = {
|
||||||
"tmp", "src", "frame", "cache", "cookie",
|
"tmp", "src", "frame", "cache", "cookie", "hist",
|
||||||
};
|
};
|
||||||
static unsigned int tmpf_seq[MAX_TMPF_TYPE];
|
static unsigned int tmpf_seq[MAX_TMPF_TYPE];
|
||||||
|
|
||||||
@@ -1710,8 +1710,23 @@ Str
|
|||||||
tmpfname(int type, char *ext)
|
tmpfname(int type, char *ext)
|
||||||
{
|
{
|
||||||
Str tmpf;
|
Str tmpf;
|
||||||
|
char *dir;
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
case TMPF_HIST:
|
||||||
|
dir = rc_dir;
|
||||||
|
break;
|
||||||
|
case TMPF_DFL:
|
||||||
|
case TMPF_COOKIE:
|
||||||
|
case TMPF_SRC:
|
||||||
|
case TMPF_FRAME:
|
||||||
|
case TMPF_CACHE:
|
||||||
|
default:
|
||||||
|
dir = tmp_dir;
|
||||||
|
}
|
||||||
|
|
||||||
tmpf = Sprintf("%s/w3m%s%d-%d%s",
|
tmpf = Sprintf("%s/w3m%s%d-%d%s",
|
||||||
tmp_dir,
|
dir,
|
||||||
tmpf_base[type],
|
tmpf_base[type],
|
||||||
CurrentPid, tmpf_seq[type]++, (ext) ? ext : "");
|
CurrentPid, tmpf_seq[type]++, (ext) ? ext : "");
|
||||||
pushText(fileToDelete, tmpf->ptr);
|
pushText(fileToDelete, tmpf->ptr);
|
||||||
|
|||||||
@@ -812,7 +812,8 @@ typedef struct http_request {
|
|||||||
#define TMPF_FRAME 2
|
#define TMPF_FRAME 2
|
||||||
#define TMPF_CACHE 3
|
#define TMPF_CACHE 3
|
||||||
#define TMPF_COOKIE 4
|
#define TMPF_COOKIE 4
|
||||||
#define MAX_TMPF_TYPE 5
|
#define TMPF_HIST 5
|
||||||
|
#define MAX_TMPF_TYPE 6
|
||||||
|
|
||||||
#define set_no_proxy(domains) (NO_proxy_domains=make_domain_list(domains))
|
#define set_no_proxy(domains) (NO_proxy_domains=make_domain_list(domains))
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ saveHistory(Hist *hist, size_t size)
|
|||||||
|
|
||||||
if (hist == NULL || hist->list == NULL)
|
if (hist == NULL || hist->list == NULL)
|
||||||
return;
|
return;
|
||||||
tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
|
tmpf = tmpfname(TMPF_HIST, NULL)->ptr;
|
||||||
if ((f = fopen(tmpf, "w")) == NULL) {
|
if ((f = fopen(tmpf, "w")) == NULL) {
|
||||||
/* FIXME: gettextize? */
|
/* FIXME: gettextize? */
|
||||||
disp_err_message("Can't open history", FALSE);
|
disp_err_message("Can't open history", FALSE);
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ static int OptionEncode = FALSE;
|
|||||||
#define CMT_DROOT N_("Directory corresponding to / (document root)")
|
#define CMT_DROOT N_("Directory corresponding to / (document root)")
|
||||||
#define CMT_PDROOT N_("Directory corresponding to /~user")
|
#define CMT_PDROOT N_("Directory corresponding to /~user")
|
||||||
#define CMT_CGIBIN N_("Directory corresponding to /cgi-bin")
|
#define CMT_CGIBIN N_("Directory corresponding to /cgi-bin")
|
||||||
|
#define CMT_TMP N_("Directory for temporary files")
|
||||||
#define CMT_CONFIRM_QQ N_("Confirm when quitting with q")
|
#define CMT_CONFIRM_QQ N_("Confirm when quitting with q")
|
||||||
#define CMT_CLOSE_TAB_BACK N_("Close tab if buffer is last when back")
|
#define CMT_CLOSE_TAB_BACK N_("Close tab if buffer is last when back")
|
||||||
#ifdef USE_MARK
|
#ifdef USE_MARK
|
||||||
@@ -580,6 +581,7 @@ struct param_ptr params5[] = {
|
|||||||
(void *)&personal_document_root, CMT_PDROOT, NULL},
|
(void *)&personal_document_root, CMT_PDROOT, NULL},
|
||||||
{"cgi_bin", P_STRING, PI_TEXT, (void *)&cgi_bin, CMT_CGIBIN, NULL},
|
{"cgi_bin", P_STRING, PI_TEXT, (void *)&cgi_bin, CMT_CGIBIN, NULL},
|
||||||
{"index_file", P_STRING, PI_TEXT, (void *)&index_file, CMT_IFILE, NULL},
|
{"index_file", P_STRING, PI_TEXT, (void *)&index_file, CMT_IFILE, NULL},
|
||||||
|
{"tmp_dir", P_STRING, PI_TEXT, (void *)&tmp_dir, CMT_TMP, NULL},
|
||||||
{NULL, 0, 0, NULL, NULL, NULL},
|
{NULL, 0, 0, NULL, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user