blob: e5367028c64883277f23bcd56ec6a0ac439d3055 (
plain)
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
|
BEGIN { split(COMPATDIRS, dirs); n = 1; last_prefix = "" }
/^#/ { print; }
{
if (NF > 0) {
pos = index($0, S);
if (pos == 0) {
print;
next;
}
prefix = substr($0, 1, pos)
if (prefix != last_prefix) {
for (d in dirs) {
for (f = 1; f < n; f++) {
x=files[f]; sub(S, S "/" dirs[d], x);
print x;
}
}
delete files;
n = 1;
last_prefix = prefix;
}
files[n++] = $0;
}
next
}
END {
for (d in dirs) {
for (f = 1; f < n; f++) {
x=files[f]; sub(S, S "/" dirs[d], x); print x;
}
}
}
|