5 # Merge two boot loader help files for FreeBSD 3.0
6 # Joe Abley <jabley@patho.gen.nz>
15 # beginning of first command
16 /^
###/ && (state == 0) \
23 /^
# T[[:graph:]]+ (S[[:graph:]]+ )*D[[:graph:]][[:print:]]*$/ && (state == 1) \
25 match($
0, " T[[:graph:]]+");
26 T =
substr($
0, RSTART + 2, RLENGTH - 2);
27 match($
0, " S[[:graph:]]+");
29 S =
(RLENGTH ==
-1) ?
"" : substr($
0, RSTART + 2, RLENGTH - 2);
30 match($
0, " D[[:graph:]][[:print:]]*$");
31 D =
substr($
0, RSTART + 2);
35 # find a suitable place to store this one...
42 help
[ind
, "link"] =
-1;
45 while (help
[i
, "T"] help
[i
, "S"] < T S
)
54 help
[j
, "link"] = ind
;
55 help
[ind
, "link"] =
-1;
57 help
[ind
, "link"] = i
;
61 help
[j
, "link"] = ind
;
70 help
[ind
, "text"] =
0;
74 # end of last command, beginning of next one
75 /^
###/ && (state == 2) \
82 sub("[[:blank:]]+$", "");
83 if (help
[ind
, "text"] ==
0 && $
0 ~
/^
[[:blank
:]]*$
/) next;
84 help
[ind
, "text", help
[ind
, "text"]] = $
0;
89 # show them what we have (it's already sorted in help[])
95 printf "################################################################################\n";
96 printf "# T%s ", help
[node
, "T"];
97 if (help
[node
, "S"] != "") printf "S%s ", help
[node
, "S"];
98 printf "D%s\n\n", help
[node
, "D"];
99 for (i =
0; i
< help
[node
, "text"]; i
++)
100 printf "%s\n", help
[node
, "text", i
];
101 node = help
[node
, "link"];
103 printf "################################################################################\n";