summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorryoon <ryoon>2014-03-11 21:32:11 +0000
committerryoon <ryoon>2014-03-11 21:32:11 +0000
commit196447994a189b741907ff8ef3639a129c3b85e7 (patch)
tree350d436d55ba08a7b4fce23b2fec35a8f1412a48 /mk
parentf210fe123e92141772d8e20dfb1982f4bd4babd5 (diff)
downloadpkgsrc-196447994a189b741907ff8ef3639a129c3b85e7.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')
-rw-r--r--mk/check/check-portability.awk13
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++) {