aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-22 22:29:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-22 22:29:56 -0700
commit508cf8813466b5e3a9993848b400ea3808bf0127 (patch)
treee03f9c77761b2df36e589b5b185f2627ed1faf4d
parent79c93ce5fca746e3bddbb57ab7dc6e30abd32de2 (diff)
downloadcppawk-508cf8813466b5e3a9993848b400ea3808bf0127.tar.gz
cppawk-508cf8813466b5e3a9993848b400ea3808bf0127.tar.bz2
cppawk-508cf8813466b5e3a9993848b400ea3808bf0127.zip
bugfix: missing space breaks --prepro-only.
Fix issue with interpolation of $prepro_opts in the case when the awk program is in the command line.
-rwxr-xr-xcppawk2
-rw-r--r--testcases8
2 files changed, 9 insertions, 1 deletions
diff --git a/cppawk b/cppawk
index 565a445..272f83d 100755
--- a/cppawk
+++ b/cppawk
@@ -154,7 +154,7 @@ elif [ $# -gt 0 ] ; then
tmp_file=$(mktemp)
if [ $prepro_only ] ; then
printf "%s" "$1" | $delhashbang | \
- eval '$prepro $incopt"$(pwd)"'"$prepro_opts - | collapse"
+ eval '$prepro $incopt"$(pwd)" '"$prepro_opts - | collapse"
else
printf "%s" "$1" | $delhashbang | \
eval '$prepro $incopt"$(pwd)" '"$prepro_opts - | collapse" > $tmp_file
diff --git a/testcases b/testcases
index 8b7dc81..2cd3ed4 100644
--- a/testcases
+++ b/testcases
@@ -170,3 +170,11 @@ BEGIN {
}'
:
-2147483648 -2147483648 -2147483648
+--
+31:
+./cppawk --prepro-only '
+#if __gawk__
+foo_bar
+#endif' | grep foo_bar
+:
+foo_bar