12 while($line and ($line =~ /^#/ or $line =~ /^\s*$/)) {
15 if (!$line) { return 0; }
17 while ($line =~ m/^(.*)\\$/) {
26 my $cmd = "$_[1]" ? "$_[1]\\b\\s*" : "";;
27 my $indentexp = (@_ == 3) ? "$_[2]\\s+" : "";
29 if ($line =~ /^${indentexp}${cmd}(([^\s](.*[^\s])?)?)\s*$/) {
38 my $indent = ($line =~ /(\s*)[^\s]/) ? $1 : "";
40 1 while (nextline && match($line, "", $indent));
42 sub get_address_family {
43 print ".SH " . uc($match) . " ADDRESS FAMILY\n";
44 print "This section documents the methods available in the\n";
45 print "$match address family.\n";
48 sub get_architecture {
54 my $indent = ($line =~ /(\s*)\S/) ? $1 : "";
59 while ($line and match($line, "", $indent)) {
60 if (match($line, "description", $indent)) {
61 $description = get_description();
62 } elsif (match($line, "options", $indent)) {
63 @options = get_options();
69 print ".SS The $method Method\n";
70 if ($description ne "") {
71 print usenet2man($description) . "\n";
73 print "(No description)\n";
79 foreach my $o (@options) {
80 if ($o =~ m/^\s*(\S*)\s*(.*)\s+--\s+(\S.*)$/) {
86 print " \" $optargs\"" unless($optargs =~ m/^\s*$/);
88 print usenet2man($dsc) . "\n";
96 print "(No options)\n";
100 sub get_description {
102 my $indent = ($line =~ /(\s*)\S/) ? $1 : "";
103 while(nextline && match($line, "", $indent)) {
113 while ($in =~ m%^([^*/]*)([*/])([^*/]*)([*/])(.*)$%s) {
114 my ($pre, $l, $mid, $r, $post) = ($1, $2, $3, $4, $5);
115 if ($l eq $r && " $pre" =~ m/[[:punct:][:space:]]$/
116 && "$post " =~ m/^[[:punct:][:space:]]/) {
118 $out .= ($l eq "*" ? '\fB' : '\fI') . $mid . '\fP';
119 ($in = $post) =~ s/^\s+/ /;
122 $in = $mid . $r . $post;
129 my $indent = ($line =~ /(\s*)\S/) ? $1 : "";
130 while(nextline && match($line, "", $indent)) {
138 if ($line and match($line, "address_family")) {
139 get_address_family $match;
141 die "address_family must be listed first\n";
143 if ($line and match($line, "architecture")) {
144 get_architecture $match;
146 while ($line and match($line, "method")) {