chiark / gitweb /
mon/tripemon.in: Show per-peer crypto details in peer info sheet.
[tripe] / common / make-summary
1 #! /usr/bin/awk -f
2
3 BEGIN { n = 0; opts = 0; sep = 0; }
4
5 /^\.\\\"\* ([0-9]+) (.*)$/ {
6   n = $2;
7   name = $3;
8   for (i = 4; i <= NF; i++) name = name " " $i;
9   head[n] = name;
10 }
11 /^\.\\\"\+opts$/ { opts = 1; lines[n] = lines[n] "\\h'2n'Options:\n.RS\n"; }
12 /^\.\\\"\-opts$/ { opts = 0; lines[n] = lines[n] ".RE\n"; }
13 /^\.\\\"\+sep$/ { sep = 1; }
14 /^\.\\\"\-sep$/ { sep = 0; }
15 /^\.\\\"\-opts$/ { opts = 0; lines[n] = lines[n] ".RE\n"; }
16 /^\.SP/ { print ".TP"; getline; lines[n] = lines[n] $0 "\n"; }
17 /^\.TP/ { if (opts) { print; getline; lines[n] = lines[n] $0 "\n"; } }
18 /^\.SS/ { if (sep) lines[n] = lines[n] ".PP\n"; }
19
20 { print; }
21
22 /^\.\\\"= summary/ {
23   for (i = 0; i < 100; i++) {
24     if (!(i in head)) continue;
25     print ".SS \"" head[i] "\"";
26     print ".nf";
27     print lines[i] ".fi";
28   }
29 }