Changeset 445 in openpam
- Timestamp:
- 10/22/11 02:45:26 (19 months ago)
- File:
-
- 1 edited
-
trunk/misc/gendoc.pl (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/misc/gendoc.pl
r437 r445 42 42 use Getopt::Std; 43 43 use POSIX qw(locale_h strftime); 44 use vars qw($COPYRIGHT $TODAY %FUNCTIONS %PAMERR);44 use vars qw($COPYRIGHT %AUTHORS $TODAY %FUNCTIONS %PAMERR); 45 45 46 46 $COPYRIGHT = ".\\\"- … … 78 78 .\\\" SUCH DAMAGE. 79 79 .\\\" 80 .\\\" \$" . " P4" . "\$80 .\\\" \$" . "Id" . "\$ 81 81 .\\\""; 82 83 %AUTHORS = ( 84 THINKSEC => "ThinkSec AS and Network Associates Laboratories, the 85 Security Research Division of Network Associates, Inc.\\& under 86 DARPA/SPAWAR contract N66001-01-C-8035 87 .Pq Dq CBOSS , 88 as part of the DARPA CHATS research program.", 89 DES => ".An Dag-Erling Sm\\(/orgrav Aq des\@FreeBSD.org .", 90 ); 82 91 83 92 %PAMERR = ( … … 129 138 my %xref; 130 139 my @errors; 140 my $author; 131 141 132 142 if ($fn !~ m,\.c$,) { … … 135 145 } 136 146 137 sysopen(FILE, $fn, O_RDONLY)147 open(FILE, "<", "$fn") 138 148 or die("$fn: open(): $!\n"); 139 149 $source = join('', <FILE>); … … 142 152 return undef 143 153 if ($source =~ m/^ \* NOPARSE\s*$/m); 154 155 $author = 'THINKSEC'; 156 if ($source =~ s/^ \* AUTHOR\s+(.*?)\s*$//m) { 157 $author = $1; 158 } 144 159 145 160 $func = $fn; … … 212 227 next; 213 228 } 214 if (s/^\s+( =?\w+):\s*/.It $1/) {229 if (s/^\s+([=%]?\w+):\s*/.It $1/) { 215 230 if ($inliteral) { 216 231 $man .= ".Ed\n"; … … 264 279 $man .= ".Ed\n"; 265 280 } 281 $man =~ s/\%/\\&\%/gs; 266 282 $man =~ s/(\n\.[A-Z][a-z] [\w ]+)\n([\.,:;-]\S*)\s*/$1 $2\n/gs; 267 283 $man =~ s/\s*$/\n/gm; … … 283 299 'xref' => \%xref, 284 300 'errors' => \@errors, 301 'author' => $author, 285 302 }; 286 303 if ($source =~ m/^ \* NODOC\s*$/m) { … … 446 463 function and this manual page were developed for the 447 464 .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 465 Project by\n" . $AUTHORS{$func->{'author'} // 'THINKSEC_DARPA'} . "\n"; 455 466 $fn = "$func->{'name'}.3"; 456 if ( sysopen(FILE, $fn, O_RDWR|O_CREAT|O_TRUNC)) {467 if (open(FILE, ">", $fn)) { 457 468 print(FILE $mdoc); 458 469 close(FILE); … … 468 479 my %func; 469 480 470 sysopen(FILE, $fn, O_RDONLY)481 open(FILE, "<", "$fn") 471 482 or die("$fn: open(): $!\n"); 472 483 while (<FILE>) { … … 495 506 my %xref; 496 507 497 sysopen(FILE, "$page.3", O_RDWR|O_CREAT|O_TRUNC)508 open(FILE, ">", "$page.3") 498 509 or die("$page.3: $!\n"); 499 510 500 $upage = uc($page); 511 $page =~ m/(\w+)$/; 512 $upage = uc($1); 501 513 print FILE "$COPYRIGHT 502 514 .Dd $TODAY … … 571 583 sub usage() { 572 584 573 print(STDERR "usage: gendoc [- s] source [...]\n");585 print(STDERR "usage: gendoc [-op] source [...]\n"); 574 586 exit(1); 575 587 } … … 580 592 usage() 581 593 unless (@ARGV && getopts("op", \%opts)); 582 setlocale(LC_ALL, "en_US. ISO8859-1");594 setlocale(LC_ALL, "en_US.UTF-8"); 583 595 $TODAY = strftime("%B %e, %Y", localtime(time())); 584 596 $TODAY =~ s,\s+, ,g;
Note: See TracChangeset
for help on using the changeset viewer.