diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-23 07:39:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-23 07:39:55 -0700 |
commit | 4e2856ddbea81e48bee950767fa4ac1a5ff6c453 (patch) | |
tree | c871c4ac5d9b5a8eb1c0dc78a05bfef219ce9954 | |
parent | 7f9133cd98879c7d8cee249b7433973b37c52832 (diff) | |
download | cppawk-4e2856ddbea81e48bee950767fa4ac1a5ff6c453.tar.gz cppawk-4e2856ddbea81e48bee950767fa4ac1a5ff6c453.tar.bz2 cppawk-4e2856ddbea81e48bee950767fa4ac1a5ff6c453.zip |
hygiene: what if $awk matches name of function?
We use the "command" command to make sure we are running an
external awk and preprocessor. For instance if someone were
to try "cppawk --awk=quote", that would be targetting the
quote function inside cppawk and not that users Awk program
that happens to be called "quote".
-rwxr-xr-x | cppawk | 16 | ||||
-rw-r--r-- | testcases | 5 |
2 files changed, 21 insertions, 0 deletions
@@ -151,6 +151,22 @@ while [ $# -gt 0 ] ; do shift done +case $awk in + 'command '* ) + ;; + * ) + awk="command $awk" + ;; +esac + +case $prepro in + 'command '* ) + ;; + * ) + prepro="command $prepro" + ;; +esac + trap 'rm -f $tmp_file' EXIT INT TERM if [ -n "$awk_file" ] ; then @@ -198,3 +198,8 @@ mawk=1 ./cppawk --prepro-only --awk=mawk gawk=__gawk__ | grep gawk : gawk=__gawk__ +-- +36: +./cppawk --prepro=die --prepro-only x 2>&1 | grep 'not found' +: +./cppawk: 1: eval: die: not found |