From a6cf02bdc7897e2fac9f51f3dd456d99ee8ada46 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 27 Feb 2013 23:38:38 +0100 Subject: [PATCH] Changed default frontend for "-" to "script" (was: "ilang") --- kernel/driver.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index ae1796757..bfbf21050 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -37,22 +37,25 @@ static void run_frontend(std::string filename, std::string command, RTLIL::Desig else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".ys") command = "script"; else if (filename == "-") - command = "ilang"; + command = "script"; else log_error("Can't guess frontend for input file `%s' (missing -f option)!\n", filename.c_str()); } if (command == "script") { log("\n-- Executing script file `%s' --\n", filename.c_str()); - FILE *f = fopen(filename.c_str(), "r"); + FILE *f = stdin; + if (filename != "-") + f = fopen(filename.c_str(), "r"); if (f == NULL) - log_error("Can;t open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno)); + log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno)); char buffer[4096]; while (fgets(buffer, 4096, f) != NULL) { Pass::call(design, buffer); design->check(); } - fclose(f); + if (filename != "-") + fclose(f); if (backend_command != NULL && *backend_command == "auto") *backend_command = ""; return; -- 2.30.2