| 1 |
@load "filefuncs" |
| 2 |
|
| 3 |
function foo() |
| 4 |
{ |
| 5 |
print "foo!" |
| 6 |
} |
| 7 |
|
| 8 |
BEGIN { |
| 9 |
f = FUNCTAB["foo"] |
| 10 |
@f() |
| 11 |
|
| 12 |
# Do the two stats one after the other, and use ".." instead |
| 13 |
# of "." to avoid race conditions seen using ".". |
| 14 |
ret1 = stat("..", data1) |
| 15 |
|
| 16 |
f = "stat" |
| 17 |
ret2 = @f("..", data2) |
| 18 |
|
| 19 |
print "ret1 =", ret1 |
| 20 |
print "ret2 =", ret2 |
| 21 |
|
| 22 |
problem = 0 |
| 23 |
for (i in data1) { |
| 24 |
if (! isarray(data1[i])) { |
| 25 |
# print i, data1[i] |
| 26 |
if (! (i in data2) || data1[i] != data2[i]) { |
| 27 |
printf("mismatch element \"%s\"\n", i) |
| 28 |
problems++ |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
print(problems ? (problems+0) "encountered" : "no problems encountered") |
| 33 |
} |