w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit c764f8c3b77e64f9135ccf6c5639b7926b48b542
parent d8b1a21114d308aac2e597382254ab269dee0f93
Author: ukai <ukai>
Date:   Thu,  5 Dec 2002 16:34:33 +0000

[w3m-dev 03530] save history
* history.c (saveHistory): save tmpfile and rename
From: Takahashi Youichirou <nikuq@hk.airnet.ne.jp>

Diffstat:
MChangeLog | 5+++++
Mhistory.c | 5++++-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,8 @@ +2002-12-06 Takahashi Youichirou <nikuq@hk.airnet.ne.jp> + + * [w3m-dev 03530] save history + * history.c (saveHistory): save tmpfile and rename + 2002-12-06 Fumitoshi UKAI <ukai@debian.or.jp> * NEWS: func: ACCESSKEY, LINK_MENU diff --git a/history.c b/history.c @@ -54,10 +54,12 @@ saveHistory(Hist *hist, size_t size) { FILE *f; HistItem *item; + char *tmpf; if (hist == NULL || hist->list == NULL) return; - if ((f = fopen(rcFile(HISTORY_FILE), "w")) == NULL) { + tmpf = tmpfname(TMPF_DFL, NULL)->ptr; + if ((f = fopen(tmpf, "w")) == NULL) { disp_err_message("Can't open history", FALSE); return; } @@ -67,6 +69,7 @@ saveHistory(Hist *hist, size_t size) for (; item; item = item->next) fprintf(f, "%s\n", (char *)item->ptr); fclose(f); + rename(tmpf, rcFile(HISTORY_FILE)); } #endif /* USE_HISTORY */