# HG changeset patch # User Luke Mewburn # Date 1583794210 -39600 # Node ID 2f65b828eceda42b13fb4851c4461d93eb9954a7 # Parent 1404de313b857a03ede082225b1e3cf5edf87647 org_to_fd: add QoSFilterRule. improve error handling diff -r 1404de313b85 -r 2f65b828eced contrib/tools/org_to_fd.pl --- 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;