File: nsindirect2.awk

package info (click to toggle)
gawk 1%3A5.3.2-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 24,120 kB
  • sloc: ansic: 56,743; awk: 14,966; sh: 6,985; yacc: 6,820; makefile: 3,144; sed: 119; python: 31; csh: 6
file content (44 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
BEGIN {
	stftime::gensub = 3	# should be OK, not related to indirect calls
}


BEGIN { base_time = systime() }	# in awk namespace

@namespace "testing"

function strftime(mesg)
{
	printf("strftime(%s) - this is not the function you are looking for\n",
		mesg)
	return 0
}

BEGIN {
	strftime("from 'testing'")
	gensub = "gensub"
	print "gensub =", gensub
}

function systime()
{
	return awk::base_time
}

BEGIN {
	st = "systime"
	now[1] = @st()

	st = "awk::systime"
	now[2] = @st()

	st = "testing::systime"
	now[3] = @st()

	for (i = 1; i <= 3; i++) {
		if (now[i] == awk::base_time || now[i] == awk::base_time + 1)
			printf "iteration %d, got good result from systime\n", i
		else
			printf "iteration %d, got bad result from systime, now %d, base_time %d\n", i, now, awk::base_time
	}
}