diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-06-10 15:42:52 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-06-10 15:42:52 +0200 |
commit | 15ff4cc63b95dde4c0445610586b4d80097a5681 (patch) | |
tree | 77053ec9ae90ff3228d9ce8cc06a707bd29a8152 | |
parent | a6370ce857bdb547804a9c5905a6dc4ffa433ee6 (diff) | |
download | yosys-15ff4cc63b95dde4c0445610586b4d80097a5681.tar.gz yosys-15ff4cc63b95dde4c0445610586b4d80097a5681.tar.bz2 yosys-15ff4cc63b95dde4c0445610586b4d80097a5681.zip |
Added history file read/write to driver
-rw-r--r-- | kernel/driver.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 886cb1f4a..0bb12f94d 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -429,6 +429,14 @@ int main(int argc, char **argv) bool scriptfile_tcl = false; bool got_output_filename = false; + int history_offset = 0; + std::string history_file; + if (getenv("HOME") != NULL) { + history_file = stringf("%s/.yosys_history", getenv("HOME")); + read_history(history_file.c_str()); + history_offset = where_history(); + } + int opt; while ((opt = getopt(argc, argv, "Sm:f:b:o:p:l:qts:c:")) != -1) { @@ -601,6 +609,14 @@ int main(int argc, char **argv) log("\nREADY.\n"); log_pop(); + if (!history_file.empty()) { + if (history_offset > 0) { + history_truncate_file(history_file.c_str(), 100); + append_history(where_history() - history_offset, history_file.c_str()); + } else + write_history(history_file.c_str()); + } + for (auto f : log_files) if (f != stderr) fclose(f); |