Debian Codegraph @

test/nsindirect2.awk

raw
1 BEGIN {
2 stftime::gensub = 3 # should be OK, not related to indirect calls
3 }
4
5
6 BEGIN { base_time = systime() } # in awk namespace
7
8 @namespace "testing"
9
10 function strftime(mesg)
11 {
12 printf("strftime(%s) - this is not the function you are looking for\n",
13 mesg)
14 return 0
15 }
16
17 BEGIN {
18 strftime("from 'testing'")
19 gensub = "gensub"
20 print "gensub =", gensub
21 }
22
23 function systime()
24 {
25 return awk::base_time
26 }
27
28 BEGIN {
29 st = "systime"
30 now[1] = @st()
31
32 st = "awk::systime"
33 now[2] = @st()
34
35 st = "testing::systime"
36 now[3] = @st()
37
38 for (i = 1; i <= 3; i++) {
39 if (now[i] == awk::base_time || now[i] == awk::base_time + 1)
40 printf "iteration %d, got good result from systime\n", i
41 else
42 printf "iteration %d, got bad result from systime, now %d, base_time %d\n", i, now, awk::base_time
43 }
44 }