--- a/src/AwkHandler.h Mon May 06 20:38:17 2019 +0200
+++ b/src/AwkHandler.h Mon May 06 21:57:16 2019 +0200
@@ -151,6 +151,7 @@
redirectFD(awkInputReaderFD, STDIN_FILENO);
redirectFD(awkOutputWriterFD, STDOUT_FILENO);
+ // AWK script:
std::wstringstream awkScript;
awkScript << L"BEGIN {" << std::endl;
awkScript << L"FS=\"\\t\";" << std::endl;
@@ -162,8 +163,14 @@
awkScript << L"{print \"AWK says: line \" NR \" '\" $0 \"' has \" NF \" fields; first field is '\" $1 \"'\";}" << std::endl;
+ // CLI arguments:
std::vector<std::string> args;
args.push_back("awk");
+
+ for (auto d : configuration.definitions) {
+ args.push_back("-v");
+ args.push_back(convertor.to_bytes(a2v(d.name) + L"=" + d.value));
+ }
args.push_back(convertor.to_bytes(awkScript.str()));
// Runs AWK program found on $PATH → user can plug-in a custom implementation or a wrapper, but this can be also bit dangerous (however AWK itself is dangerous).