#include "kernel/yosys.h"
+USING_YOSYS_NAMESPACE
+PRIVATE_NAMESPACE_BEGIN
+
struct WriteFileFrontend : public Frontend {
WriteFileFrontend() : Frontend("=write_file", "write a text to a file") { }
virtual void help()
log("\n");
log(" write_file [options] output_file [input_file]\n");
log("\n");
- log("Write the text fron the input file to the output file.\n");
+ log("Write the text from the input file to the output file.\n");
log("\n");
log(" -a\n");
log(" Append to output file (instead of overwriting)\n");
extra_args(f, filename, args, argidx);
FILE *of = fopen(output_filename.c_str(), append_mode ? "a" : "w");
+ yosys_output_files.insert(output_filename);
char buffer[64 * 1024];
- size_t bytes;
+ int bytes;
- while (0 < (bytes = f->readsome(buffer, sizeof(buffer))))
+ while (0 < (bytes = readsome(*f, buffer, sizeof(buffer))))
fwrite(buffer, bytes, 1, of);
fclose(of);
}
} WriteFileFrontend;
+PRIVATE_NAMESPACE_END