summaryrefslogtreecommitdiff
path: root/src/history.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/history.cc')
-rw-r--r--src/history.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/history.cc b/src/history.cc
index 33d946c..63601aa 100644
--- a/src/history.cc
+++ b/src/history.cc
@@ -65,17 +65,19 @@ HistoryFile::sync_the_file()
if (!configuration.get_int("History", HIST_MAX_SIZE))
HIST_MAX_SIZE = 20;
- ofstream f(filename, ios::out);
+ if (HIST_MAX_SIZE) {
+ ofstream f(filename, ios::out);
- int start = 0;
- if (history.size() > (size_t)HIST_MAX_SIZE)
- start = history.size() - HIST_MAX_SIZE;
+ int start = 0;
+ if (history.size() > (size_t)HIST_MAX_SIZE)
+ start = history.size() - HIST_MAX_SIZE;
- for (size_t i = start; i < history.size(); i++)
- if (history[i].length() != 0)
- f << history[i] << endl;
+ for (size_t i = start; i < history.size(); i++)
+ if (history[i].length() != 0)
+ f << history[i] << endl;
- f.flush();
+ f.flush();
+ }
}
void