linux: Use fchmodat2 on fchmod for flags different than 0 (BZ 26401)
[glibc.git] / manual / tsort.awk
blob341e7133ea53e110297f247bd478e19e9fedc116
1 #!/usr/bin/awk -f
2 # Generate topologically sorted list of manual chapters.
3 # Copyright (C) 1998-2023 Free Software Foundation, Inc.
5 BEGIN {
6 cnt = 0
7 dnt = 0
10 to[dnt] = $1
11 from[dnt] = $2
12 ++dnt
13 all[cnt++] = $1
15 END {
16 do {
17 moved = 0
18 for (i = 0; i < dnt; ++i) {
19 for (j = 0; j < cnt; ++j) {
20 if (all[j] == from[i]) {
21 for (k = j + 1; k < cnt; ++k) {
22 if (all[k] == to[i]) {
23 break;
26 if (k < cnt) {
27 for (l = k - 1; l >= j; --l) {
28 all[l + 1] = all[l]
30 all[j] = to[i]
31 break;
35 if (j < cnt) {
36 moved = 1
37 break
40 } while (moved)
42 for (i = 0; i < cnt; ++i) {
43 print all[i];