5
my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`;
7
$DEB_HOST_ARCH_OS =~ s/\n//;
17
while($line and ($line =~ /^#/ or $line =~ /^\s*$/)) {
20
if (!$line) { return 0; }
22
while ($line =~ m/^(.*)\\$/) {
30
return ($arch eq $DEB_HOST_ARCH_OS) || ($arch eq "any")
34
my $cmd = "$_[1]" ? "$_[1]\\b\\s*" : "";;
35
my $indentexp = (@_ == 3) ? "$_[2]\\s+" : "";
37
if ($line =~ /^${indentexp}${cmd}(([^\s](.*[^\s])?)?)\s*$/) {
46
my $indent = ($line =~ /(\s*)[^\s]/) ? $1 : "";
48
1 while (nextline && match($line, "", $indent));
50
sub get_address_family {
51
print ".SH " . uc($match) . " ADDRESS FAMILY\n";
52
print "This section documents the methods available in the\n";
53
print "$match address family.\n";
56
sub get_architecture {
62
my $indent = ($line =~ /(\s*)\S/) ? $1 : "";
67
while ($line and match($line, "", $indent)) {
68
if (match($line, "description", $indent)) {
69
$description = get_description();
70
} elsif (match($line, "options", $indent)) {
71
@options = get_options();
77
print ".SS The $method Method\n";
78
if ($description ne "") {
79
print usenet2man($description) . "\n";
81
print "(No description)\n";
87
foreach my $o (@options) {
88
if ($o =~ m/^\s*(\S*)\s*(.*)\s+--\s+(\S[^[]*)(\s+\[([^]]*)\]\s*)?$/) {
92
$dsc .= (length($5)) ? ". Default value: \"$5\"" : "";
95
print " \" $optargs\"" unless($optargs =~ m/^\s*$/);
97
print usenet2man($dsc) . "\n";
105
print "(No options)\n";
109
sub get_description {
111
my $indent = ($line =~ /(\s*)\S/) ? $1 : "";
112
while(nextline && match($line, "", $indent)) {
122
while ($in =~ m%^([^*/]*)([*/])([^*/]*)([*/])(.*)$%s) {
123
my ($pre, $l, $mid, $r, $post) = ($1, $2, $3, $4, $5);
124
if ($l eq $r && " $pre" =~ m/[[:punct:][:space:]]$/
125
&& "$post " =~ m/^[[:punct:][:space:]]/) {
127
$out .= ($l eq "*" ? '\fB' : '\fI') . $mid . '\fP';
128
($in = $post) =~ s/^\s+/ /;
131
$in = $mid . $r . $post;
138
my $indent = ($line =~ /(\s*)\S/) ? $1 : "";
139
while(nextline && match($line, "", $indent)) {
148
if (match($line, "address_family")) {
149
get_address_family $match;
152
if (match($line, "architecture")) {
153
get_architecture $match;
156
if (match($line, "method")) {
166
die("Unknown command \"$line\"");