blob: 7acdcfe31e0d60b620129b21d0b711f0662b26cf (
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
33
34
35
36
37
38
39
40
41
42
43
|
# $NetBSD: merge-distinfo.awk,v 1.1 2007/07/29 05:19:43 jlam Exp $
#
# This awk script sorts the contents of several distinfo files into a
# single distinfo file.
#
# insertion sort
function sort(a, nelem, temp, i, j) {
for (i = 2; i <= nelem; ++i) {
for (j = i; a[j-1] > a[j]; --j) {
temp = a[j]
a[j] = a[j-1]
a[j-1] = temp
}
}
return
}
/^[A-Z]+/ {
file = $2
files[file] = file
if (!($0 in seen)) {
seen[$0] = $0
properties[file, 0]++
properties[file, properties[file, 0]] = $0
}
}
END {
print "$" "NetBSD" "$"
print ""
n = 1
for (f in files) {
orderedfiles[n++] = f
}
n--;
sort(orderedfiles, n)
for (i = 1; i <= n; i++) {
f = orderedfiles[i]
for (j = 1; j <= properties[f, 0]; j++)
print properties[f, j]
}
}
|