summaryrefslogtreecommitdiff
path: root/tools/ianatable2defines.pl
blob: 933b318fd70ece3da774cfafe2fa41773cc53e07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use strict;
use warnings;

my $pfx = shift || '';

# typical input:
# 1       OPTION_CLIENTID [RFC3315]

while (<>) {
    my ($code, $name, $ref, $rest) = split(/\s/);
    if ($rest || !$ref) { # i.e. parse failure
	chomp;
	print "/* $_ */\n";
	next;
    }
    $name =~ s/-/_/g;
    print "#define $name\t\t$code\t/* $ref */\n";
}