changeset 1465:2f65b828eced

org_to_fd: add QoSFilterRule. improve error handling
author Luke Mewburn <luke@mewburn.net>
date Tue, 10 Mar 2020 09:50:10 +1100
parents 1404de313b85
children d35c6171e630
files contrib/tools/org_to_fd.pl
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/tools/org_to_fd.pl	Tue Mar 10 09:33:41 2020 +1100
+++ b/contrib/tools/org_to_fd.pl	Tue Mar 10 09:50:10 2020 +1100
@@ -24,7 +24,7 @@
     my ($type) = @_;
 
     return "AVP_TYPE_GROUPED" if ($type =~ m/Grouped/);
-    return "AVP_TYPE_OCTETSTRING" if ($type =~ m/(Address|DiameterIdentity|DiameterURI|OctetString|IPFilterRule|Time|UTF8String)/);
+    return "AVP_TYPE_OCTETSTRING" if ($type =~ m/(Address|DiameterIdentity|DiameterURI|OctetString|IPFilterRule|Time|UTF8String|QoSFilterRule)/);
     return "AVP_TYPE_INTEGER32" if ($type =~ m/Enumerated|Integer32/);
     return "AVP_TYPE_INTEGER64" if ($type =~ m/Integer64/);
     return "AVP_TYPE_UNSIGNED32" if ($type =~ m/Unsigned32/);
@@ -32,7 +32,7 @@
     return "AVP_TYPE_FLOAT32" if ($type =~ m/Float32/);
     return "AVP_TYPE_FLOAT64" if ($type =~ m/Float64/);
 
-    return "UNKNOWN TYPE: $type";
+    die("unknown type '$type'");
 }
 
 
@@ -67,8 +67,8 @@
 }
 
 sub usage($) {
-    die(sprintf("usage: %s [-V vendor_name] [-v vendor_code] [file ...]\n", $progname));
-    exit(@_);
+    print STDERR "usage: $progname [-V vendor_name] [-v vendor_code] [file ...]\n";
+    exit(1);
 }
 
 getopts("V:v:") || usage(1);
@@ -85,7 +85,7 @@
 print_comment("Start of generated data.");
 print_comment("");
 print_comment("The following is created automatically with:");
-print_comment(sprintf("    org_to_fd.pl -V '%s' -v %s", $vendor_name, $vendor));
+print_comment("    org_to_fd.pl -V '$vendor_name' -v $vendor");
 print_comment("Changes will be lost during the next update.");
 print_comment("Do not modify; modify the source .org file instead.");
 print_header();
@@ -105,7 +105,7 @@
     }
 
     if ($name =~ m/\s/) {
-        die(sprintf("name '%s' contains space", $name));
+        die("name '$name' contains space");
     }
 
     my ($desc) = $name;
"Welcome to our mercurial repository"