1 |
#!/usr/bin/perl |
2 |
use strict; |
3 |
my $in_section = 0; |
4 |
my $in_desc = 0; |
5 |
my %errors; |
6 |
my $cur_error; |
7 |
|
8 |
while (<STDIN>) { |
9 |
if (/^\s+(\d+)\s+((?:ERR|RPL)_\S+)\s*$/) { |
10 |
$cur_error = $1; |
11 |
$errors{$cur_error}->{name} = $2; |
12 |
} elsif (/^\s+"([^:]+):.*"\s*$/) { |
13 |
$errors{$cur_error}->{params} = [ split /\s+/, $1 ]; |
14 |
} |
15 |
} |
16 |
|
17 |
print "our %RFC_NUMCODE_MAP = (\n"; |
18 |
for (sort keys %errors) { |
19 |
next unless $_ != 0; |
20 |
my $pcnt = 0; |
21 |
printf " '%03d' => '%s',\n", |
22 |
$_, $errors{$_}->{name}; |
23 |
} |
24 |
print ");\n"; |