10 # Each manual page contains lines of the form
14 # for each function and macro documented in it. This program sifts through
15 # all of the `toplevel' manual pages and creates little manpages which
16 # include the main text for each of the functions.
18 # The file `links' contains a generated list of little link manpages. This
19 # list is used for tidying (on a `make clean'), installing (for `make
20 # install') and for pruning out old links when they're not needed any more.
24 if (open SO
, "links") { while (<SO
>) { chomp
; $so{$_} = -1; } }
25 if (open TOP
, "toplevel") { while (<TOP
>) { chomp
; $top{$_} = -1; } }
28 ($ext = $f) =~ s
/^
[^.
]*\.
//;
29 next unless
$ext =~
/^\d
/;
31 open FILE
, $f or die
"open($f): $!";
35 next unless
/^\.
\\\"\s
+\@
/;
40 open OUT, ">$full" or die "open(>$full): $!";
41 print OUT ".so man$sec/$f\n";
50 foreach $i (keys(%so)) {
52 unlink $i if $so{$i} < 0;
56 open LINKS, ">links" or die "open(>links): $!";
57 foreach $i (sort(keys(%so))) {
58 print LINKS "$i\n" if $so{$i} >= 0;
64 foreach $i (keys(%top)) {
65 $write = 1 unless $top{$i} == 0;
68 open TOP, ">toplevel" or die "open(>toplevel): $!";
69 foreach $i (sort(keys(%top))) {
70 print TOP "$i\n" if $top{$i} >= 0;