Files
android_development/ndk/build/check-awk.awk
David 'Digit' Turner 73aaee4171 Add host check for nawk/gawk in build/host-setup.sh
Store the result as HOST_AWK in out/host/config.mk
2009-07-27 15:47:09 +02:00

26 lines
637 B
Awk

# This script is used to check that a given awk executable
# implements the match() and substr() functions appropriately.
#
# These were introduced in nawk/gawk, but the original awk
# does not have them.
#
END {
RSTART=0
RLENGTH=0
s1="A real world example"
if (! match(s1,"world")) {
print "Fail match"
} else if (RSTART != 8) {
print "Fail RSTART ="RSTART
} else if (RLENGTH != 5) {
print "Fail RLENGTH ="RLENGTH
} else {
s2=substr(s1,RSTART,RLENGTH)
if (s2 != "world") {
print "Fail substr="s2
} else {
print "Pass"
}
}
}