(_IO_new_file_attach): Use __set_errno.
[glibc/history.git] / scripts / extract-abilist.awk
blobc9adec435945c461246591a98603e9ffa6953eb0
1 # awk script to extract a config-specific .symlist file from a merged file.
2 # This must be passed run with awk -v config=TUPLE to specify the configuration
3 # tuple we will match. The merged file contains stanzas in the form:
4 # GLIBC_x.y regexp...
5 # | GLIBC_x.y.z regexp...
6 # | GLIBC_m.n regexp...
7 # function F
8 # variable D 0x4
9 # Each regexp is matched against TUPLE, and only matching stanzas go
10 # into the output, with the regexp list removed. Multiple version lines
11 # can match with the same regexp, meaning the stanza is duplicated in
12 # multiple version sets. The result matches the original .symlist file
13 # from abilist.awk that was fed into merge-abilist.awk.
15 BEGIN {
16 inside = 0;
19 /^ / {
20 inside = 1;
21 if (!ignore) {
22 for (version in current) {
23 if (version in versions)
24 versions[version] = versions[version] "\n" $0;
25 else
26 versions[version] = $0;
29 next;
33 second = ($1 == "|");
34 if (second && inside) {
35 printf "%s:%d: bad input line inside stanza: %s\n", FILENAME, FNR, $0;
36 exit 1;
38 inside = 0;
40 for (i = second ? 3 : 2; i <= NF; ++i) {
41 regex = "^" $i "$";
42 if (match(config, regex) != 0) {
43 if (!second || ignore)
44 # Clear old array.
45 split("", current);
46 current[second ? $2 : $1] = 1;
47 ignore = 0;
48 next;
52 if (!second)
53 ignore = 1;
54 next;
57 END {
58 nverlist = 0;
59 for (version in versions) {
60 if (nverslist == 0) {
61 verslist = version;
62 nverslist = 1;
63 continue;
65 split(verslist, s, "\n");
66 if (version < s[1]) {
67 verslist = version;
68 for (i = 1; i <= nverslist; ++i) {
69 verslist = verslist "\n" s[i];
72 else {
73 verslist = s[1];
74 for (i = 2; i <= nverslist; ++i) {
75 if (version < s[i]) break;
76 verslist = verslist "\n" s[i];
78 verslist = verslist "\n" version;
79 for (; i <= nverslist; ++i) {
80 verslist = verslist "\n" s[i];
83 ++nverslist;
86 split(verslist, order, "\n");
87 for (i = 1; i <= nverslist; ++i) {
88 version = order[i];
90 print version;
91 outpipe = "sort";
92 print versions[version] | outpipe;
93 close(outpipe);
95 if (version == lastversion)
96 break;