From 5293e86e5185b959a442633c93445ecfde107d1e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 17 Jul 2022 18:55:55 -0700 Subject: Implement -E option and header. The -E option is not passed through to the Awk implementation any more, which is not particularly useful, because the option resembles -f, and its argument requires likewise handling. We achieve the semantics that -E is equivalent to -f --. From the GNU Awk user's perspective, this is a regression in the semantics of -E which also has the effect of suppressing the processing of arguments which look like variable assignments. To make up for that, we provide the header which suppresses all implicit treatment of the remaining arguments. --- testdir/arg.cwk | 8 ++++++++ testdir/safearg.cwk | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 testdir/arg.cwk create mode 100644 testdir/safearg.cwk (limited to 'testdir') diff --git a/testdir/arg.cwk b/testdir/arg.cwk new file mode 100644 index 0000000..a5c98a9 --- /dev/null +++ b/testdir/arg.cwk @@ -0,0 +1,8 @@ +END { + for (x in ARGV) { + if (x != 0) + printf("ARGV[%s]=%s\n", x, ARGV[x]) + } + printf("a=%s\n", a) + printf("b=%s\n", b) +} diff --git a/testdir/safearg.cwk b/testdir/safearg.cwk new file mode 100644 index 0000000..4f29b9f --- /dev/null +++ b/testdir/safearg.cwk @@ -0,0 +1,14 @@ +#include + +END { + for (x in ARGV) { + if (x != 0) + printf("ARGV[%s]=%s\n", x, ARGV[x]) + } + for (x in argv) { + if (x != 0) + printf("argv[%s]=%s\n", x, argv[x]) + } + printf("a=%s\n", a) + printf("b=%s\n", a) +} -- cgit v1.2.3