Changeset 445 in openpam


Ignore:
Timestamp:
Oct 22, 2011, 2:45:26 AM (4 years ago)
Author:
des
Message:

Modernize, and add support for other authors than ThinkSec?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/misc/gendoc.pl

    r437 r445  
    4242use Getopt::Std;
    4343use POSIX qw(locale_h strftime);
    44 use vars qw($COPYRIGHT $TODAY %FUNCTIONS %PAMERR);
     44use vars qw($COPYRIGHT %AUTHORS $TODAY %FUNCTIONS %PAMERR);
    4545
    4646$COPYRIGHT = ".\\\"-
     
    7878.\\\" SUCH DAMAGE.
    7979.\\\"
    80 .\\\" \$" . "P4" . "\$
     80.\\\" \$" . "Id" . "\$
    8181.\\\"";
     82
     83%AUTHORS = (
     84    THINKSEC => "ThinkSec AS and Network Associates Laboratories, the
     85Security Research Division of Network Associates, Inc.\\& under
     86DARPA/SPAWAR contract N66001-01-C-8035
     87.Pq Dq CBOSS ,
     88as part of the DARPA CHATS research program.",
     89    DES => ".An Dag-Erling Sm\\(/orgrav Aq des\@FreeBSD.org .",
     90);
    8291
    8392%PAMERR = (
     
    129138    my %xref;
    130139    my @errors;
     140    my $author;
    131141
    132142    if ($fn !~ m,\.c$,) {
     
    135145    }
    136146
    137     sysopen(FILE, $fn, O_RDONLY)
     147    open(FILE, "<", "$fn")
    138148        or die("$fn: open(): $!\n");
    139149    $source = join('', <FILE>);
     
    142152    return undef
    143153        if ($source =~ m/^ \* NOPARSE\s*$/m);
     154
     155    $author = 'THINKSEC';
     156    if ($source =~ s/^ \* AUTHOR\s+(.*?)\s*$//m) {
     157        $author = $1;
     158    }
    144159
    145160    $func = $fn;
     
    212227            next;
    213228        }
    214         if (s/^\s+(=?\w+):\s*/.It $1/) {
     229        if (s/^\s+([=%]?\w+):\s*/.It $1/) {
    215230            if ($inliteral) {
    216231                $man .= ".Ed\n";
     
    264279            $man .= ".Ed\n";
    265280        }
     281        $man =~ s/\%/\\&\%/gs;
    266282        $man =~ s/(\n\.[A-Z][a-z] [\w ]+)\n([\.,:;-]\S*)\s*/$1 $2\n/gs;
    267283        $man =~ s/\s*$/\n/gm;
     
    283299        'xref'          => \%xref,
    284300        'errors'        => \@errors,
     301        'author'        => $author,
    285302    };
    286303    if ($source =~ m/^ \* NODOC\s*$/m) {
     
    446463function and this manual page were developed for the
    447464.Fx
    448 Project by ThinkSec AS and Network Associates Laboratories, the
    449 Security Research Division of Network Associates, Inc.\\& under
    450 DARPA/SPAWAR contract N66001-01-C-8035
    451 .Pq Dq CBOSS ,
    452 as part of the DARPA CHATS research program.
    453 ";
    454 
     465Project by\n" . $AUTHORS{$func->{'author'} // 'THINKSEC_DARPA'} . "\n";
    455466    $fn = "$func->{'name'}.3";
    456     if (sysopen(FILE, $fn, O_RDWR|O_CREAT|O_TRUNC)) {
     467    if (open(FILE, ">", $fn)) {
    457468        print(FILE $mdoc);
    458469        close(FILE);
     
    468479    my %func;
    469480
    470     sysopen(FILE, $fn, O_RDONLY)
     481    open(FILE, "<", "$fn")
    471482        or die("$fn: open(): $!\n");
    472483    while (<FILE>) {
     
    495506    my %xref;
    496507
    497     sysopen(FILE, "$page.3", O_RDWR|O_CREAT|O_TRUNC)
     508    open(FILE, ">", "$page.3")
    498509        or die("$page.3: $!\n");
    499510
    500     $upage = uc($page);
     511    $page =~ m/(\w+)$/;
     512    $upage = uc($1);
    501513    print FILE "$COPYRIGHT
    502514.Dd $TODAY
     
    571583sub usage() {
    572584
    573     print(STDERR "usage: gendoc [-s] source [...]\n");
     585    print(STDERR "usage: gendoc [-op] source [...]\n");
    574586    exit(1);
    575587}
     
    580592    usage()
    581593        unless (@ARGV && getopts("op", \%opts));
    582     setlocale(LC_ALL, "en_US.ISO8859-1");
     594    setlocale(LC_ALL, "en_US.UTF-8");
    583595    $TODAY = strftime("%B %e, %Y", localtime(time()));
    584596    $TODAY =~ s,\s+, ,g;
Note: See TracChangeset for help on using the changeset viewer.