comment fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2486 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
c5fe41cec8
commit
29be8031df
11
src/files.c
11
src/files.c
|
@ -2848,7 +2848,7 @@ void load_history(void)
|
||||||
{
|
{
|
||||||
char *nanohist = histfilename();
|
char *nanohist = histfilename();
|
||||||
|
|
||||||
/* assume do_rcfile() has reported missing home dir */
|
/* Assume do_rcfile() has reported a missing home directory. */
|
||||||
if (nanohist != NULL) {
|
if (nanohist != NULL) {
|
||||||
FILE *hist = fopen(nanohist, "r");
|
FILE *hist = fopen(nanohist, "r");
|
||||||
|
|
||||||
|
@ -2892,7 +2892,7 @@ bool writehist(FILE *hist, historyheadtype *histhead)
|
||||||
{
|
{
|
||||||
historytype *h;
|
historytype *h;
|
||||||
|
|
||||||
/* write oldest first */
|
/* Write oldest history first. */
|
||||||
for (h = histhead->tail; h->prev != NULL; h = h->prev) {
|
for (h = histhead->tail; h->prev != NULL; h = h->prev) {
|
||||||
size_t len = strlen(h->data);
|
size_t len = strlen(h->data);
|
||||||
|
|
||||||
|
@ -2904,12 +2904,12 @@ bool writehist(FILE *hist, historyheadtype *histhead)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save histories to ~/.nano_history */
|
/* Save histories to ~/.nano_history. */
|
||||||
void save_history(void)
|
void save_history(void)
|
||||||
{
|
{
|
||||||
char *nanohist;
|
char *nanohist;
|
||||||
|
|
||||||
/* don't save unchanged or empty histories */
|
/* Don't save unchanged or empty histories. */
|
||||||
if ((search_history.count == 0 && replace_history.count == 0) ||
|
if ((search_history.count == 0 && replace_history.count == 0) ||
|
||||||
!ISSET(HISTORY_CHANGED) || ISSET(VIEW_MODE))
|
!ISSET(HISTORY_CHANGED) || ISSET(VIEW_MODE))
|
||||||
return;
|
return;
|
||||||
|
@ -2923,7 +2923,8 @@ void save_history(void)
|
||||||
rcfile_error(N_("Error writing %s: %s"), nanohist,
|
rcfile_error(N_("Error writing %s: %s"), nanohist,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
else {
|
else {
|
||||||
/* set rw only by owner for security ?? */
|
/* Make sure no one else can read from or write to the
|
||||||
|
* history file. */
|
||||||
chmod(nanohist, S_IRUSR | S_IWUSR);
|
chmod(nanohist, S_IRUSR | S_IWUSR);
|
||||||
|
|
||||||
if (!writehist(hist, &search_history) ||
|
if (!writehist(hist, &search_history) ||
|
||||||
|
|
Loading…
Reference in New Issue