diff options
author | ryoon <ryoon@pkgsrc.org> | 2014-03-11 21:32:11 +0000 |
---|---|---|
committer | ryoon <ryoon@pkgsrc.org> | 2014-03-11 21:32:11 +0000 |
commit | f418328d2bae6c43276adfc803683c358fa8353e (patch) | |
tree | 350d436d55ba08a7b4fce23b2fec35a8f1412a48 /mk/check/check-portability.awk | |
parent | b6fd110fbf8109740378409eab2def24a8db2a53 (diff) | |
download | pkgsrc-f418328d2bae6c43276adfc803683c358fa8353e.tar.gz |
Fix "illegal reference to local variable word" error with lang/nawk
under Debian GNU/Linux 7.4.
lang/nawk's length(array) does not work as expected. So length(array) make
array as usual variable.
Diffstat (limited to 'mk/check/check-portability.awk')
-rw-r--r-- | mk/check/check-portability.awk | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mk/check/check-portability.awk b/mk/check/check-portability.awk index 6d904bc5749..04edbd9be43 100644 --- a/mk/check/check-portability.awk +++ b/mk/check/check-portability.awk @@ -1,4 +1,4 @@ -# $NetBSD: check-portability.awk,v 1.5 2014/03/01 17:57:01 jklos Exp $ +# $NetBSD: check-portability.awk,v 1.6 2014/03/11 21:32:11 ryoon Exp $ # # Checks a shell file for possible portability problems. # @@ -11,6 +11,15 @@ BEGIN { found_test_eqeq = no; } +# length(array) of lang/nawk does not work as expected. +function pkgsrc_length(arg, len) { + len = 0; + for (i in arg) { + len++ + } + return len; +} + # Check for $RANDOM, which is specific to ksh and bash. function check_random(line) { @@ -31,7 +40,7 @@ function check_random(line) { function check_test_eqeq(line, n, word, i) { - if (length(line) == 0 || length(word) == 0) + if (length(line) == 0 || pkgsrc_length(word) == 0) return; n = split(line, word); for (i = 3; i < n; i++) { |