From 59119adedce9405ce320d4609885f734d0aae5c5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 18 Mar 2022 08:15:20 -0700 Subject: Add __gawk__ predefined preprocessor symbol. --- cppawk | 6 +++--- testcases | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cppawk b/cppawk index 9a74cbf..d24300b 100755 --- a/cppawk +++ b/cppawk @@ -29,13 +29,13 @@ # site configuration prepro=/usr/bin/cpp -incopt=-iquote # GNU cpp feature: use -I if unavailable -awk=/usr/bin/gawk +incopt=-iquote # GNU cpp feature: use -I if unavailable +awk=/usr/bin/gawk # Use GNU awk +prepro_opts="-D__gawk__=1" # Blank out for generic or use __mawk__, etc. # globals awk_file= awk_opts= -prepro_opts= tmp_file= delhashbang="sed -e /^#!/d" diff --git a/testcases b/testcases index 1c2e6c8..d1a9fff 100644 --- a/testcases +++ b/testcases @@ -83,3 +83,13 @@ BEGIN { print max(42, 73) }' BEGIN { print max(42, 73) }' : 73 +-- +16: +./cppawk ' +BEGIN { +#if __gawk__ + print "gawk" +#endif +}' +: +gawk -- cgit v1.2.3