mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-27 00:18:46 +00:00
Added history file read/write to driver
This commit is contained in:
parent
a6370ce857
commit
15ff4cc63b
1 changed files with 16 additions and 0 deletions
|
@ -429,6 +429,14 @@ int main(int argc, char **argv)
|
||||||
bool scriptfile_tcl = false;
|
bool scriptfile_tcl = false;
|
||||||
bool got_output_filename = 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;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "Sm:f:b:o:p:l:qts:c:")) != -1)
|
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("\nREADY.\n");
|
||||||
log_pop();
|
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)
|
for (auto f : log_files)
|
||||||
if (f != stderr)
|
if (f != stderr)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue