Debian Codegraph @

test/getline5.awk

raw
1 # Message-ID: <[email protected]>
2 # Date: Sun, 01 Apr 2012 11:49:33 +0100
3 # From: Duncan Moore <[email protected]>
4 # To: "[email protected]" <[email protected]>
5 # Subject: [bug-gawk] getline difference from gawk versions >=4.0.0
6 #
7 # Hi
8 #
9 # b.awk:
10 #
11 # BEGIN {
12 # system("echo 1 > f")
13 # while ((getline a[++c] < "f") > 0) {}
14 # print c
15 # }
16 #
17 # gawk -f b.awk
18 #
19 # Prior to gawk 4.0.0 this outputs:
20 #
21 # 1
22 #
23 # For 4.0.0 and 4.0.1 it outputs:
24 #
25 # 2
26 #
27 # Regards
28 # Duncan Moore
29
30 BEGIN {
31 system("echo 1 > f")
32 while ((getline a[++c] < "f") > 0) {}
33 print c
34 system("rm -f f")
35 }