diff options
author | Bjørn Mork <bjorn@mork.no> | 2011-11-09 16:06:58 +0100 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2011-11-09 16:20:37 +0100 |
commit | 7be3f0592841640c07819aa23f14735de9f767d5 (patch) | |
tree | 397f691e2ce9b41150143b25327a604bea651152 | |
parent | 686948bafa42c0cc64aa230f6609cda4293de440 (diff) |
Adding a simple perl script for generating C defines based on the IANA registry
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rwxr-xr-x | tools/ianatable2defines.pl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/ianatable2defines.pl b/tools/ianatable2defines.pl new file mode 100755 index 0000000..933b318 --- /dev/null +++ b/tools/ianatable2defines.pl @@ -0,0 +1,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"; +} + |