summaryrefslogtreecommitdiff
path: root/regress/share/man/no3man
blob: 2e53f53f4ad994ea5dcdcc39864ddb50853b08bc (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
#!/usr/bin/perl -w
#	$OpenBSD: no3man,v 1.2 2001/01/29 02:05:49 niklas Exp $

#
# no3man - identify which library calls aren't mannable
# tchrist@perl.com

use strict;

#my $MAN3DIR = '/usr/man/man3';
my $MAN3DIR = '/usr/share/man/cat3';

chdir($MAN3DIR) || die "can't chdir to $MAN3DIR: $!";

opendir(DIR, ".") || die "can't opendir $MAN3DIR: $!";

my %warned;

$| = 1;

while (my $manpage = readdir(DIR)) {
    next if $manpage =~ /^\./;
    #$manpage =~ s/\.3.*//;
    $manpage =~ s/\.0.*//;
    # print "$manpage\n";
    my $kid = open(MANPIPE, "man 3 $manpage 2>&1 | col -b |")
	|| die "can't run man 3 $manpage";
    while(<MANPIPE>) {
	if (my $recno = /^(SYNOPSIS|SYNTAX)/ ... /^[A-Z]/) {
	    last if $recno =~ /e/i;
	    while (/(\w+)\(/g) {
		my $func = $1;
		my $path = `man -w 3 $func 2>&1`;
		print "$manpage(3): $path" if $?;
	    } 
	} 
    } 
    #die "$kid is me!" unless $kid;
    #kill 'TERM', $kid;
    close MANPIPE;
}