aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-18 13:14:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-18 13:14:15 -0700
commitead2fc9a61b2986957b7aa0cbc487c149b4424a5 (patch)
treed0957f1cd3a22f9fc3132af6ba709a738017010c
parentfa993f68f6ca85299d816e01914629044857e56e (diff)
downloadcppawk-ead2fc9a61b2986957b7aa0cbc487c149b4424a5.tar.gz
cppawk-ead2fc9a61b2986957b7aa0cbc487c149b4424a5.tar.bz2
cppawk-ead2fc9a61b2986957b7aa0cbc487c149b4424a5.zip
Ensure we pass -- before non-option arguments.
This is necessary even though our option processing has itself recognized the end of options. The reason is that we do not pass through -- to the list of awk options. (We cannot, because we add options after the awk options like this: $awk $awk_opts -f $tmp_file").
-rwxr-xr-xcppawk4
1 files changed, 2 insertions, 2 deletions
diff --git a/cppawk b/cppawk
index 1b2f1d6..9998b57 100755
--- a/cppawk
+++ b/cppawk
@@ -126,7 +126,7 @@ if [ -n "$awk_file" ] ; then
eval '$prepro $incopt"$(dirname "$awk_file")" '"$prepro_opts -" > $tmp_file
[ $prepro_only ] \
&& cat $tmp_file \
- || eval "$awk $awk_opts -f $tmp_file" "$@"
+ || eval "$awk $awk_opts -f $tmp_file -- \"\$@\""
elif [ $# -gt 0 ] ; then
tmp_file=$(mktemp)
if [ $prepro_only ] ; then
@@ -136,7 +136,7 @@ elif [ $# -gt 0 ] ; then
printf "%s" "$1" | $delhashbang | \
eval '$prepro $incopt"$(pwd)" '"$prepro_opts -" > $tmp_file
shift
- eval "$awk $awk_opts -f $tmp_file \"\$@\""
+ eval "$awk $awk_opts -f $tmp_file -- \"\$@\""
fi
else
die "awk code must be specified"