aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-18 08:15:20 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-18 08:15:20 -0700
commit59119adedce9405ce320d4609885f734d0aae5c5 (patch)
tree398d76985b34c54b872824b129ad3d8dc72b4113
parentbdd2a4913eaa0f1d3721979058b53e181832cfa8 (diff)
downloadcppawk-59119adedce9405ce320d4609885f734d0aae5c5.tar.gz
cppawk-59119adedce9405ce320d4609885f734d0aae5c5.tar.bz2
cppawk-59119adedce9405ce320d4609885f734d0aae5c5.zip
Add __gawk__ predefined preprocessor symbol.
-rwxr-xr-xcppawk6
-rw-r--r--testcases10
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