# HG changeset patch # User Luke Mewburn # Date 1582092293 -39600 # Node ID 3338f135989d97a87d597e6c7b388f252967b63e # Parent 38453a36d50d9e99b98cf0975686d28a9cbbe5f6 org_to_fd.pl: prevent spaces in AVP names diff -r 38453a36d50d -r 3338f135989d contrib/tools/org_to_fd.pl --- a/contrib/tools/org_to_fd.pl Wed Feb 19 16:57:33 2020 +1100 +++ b/contrib/tools/org_to_fd.pl Wed Feb 19 17:04:53 2020 +1100 @@ -70,18 +70,17 @@ print "\t/* Changes will be lost during the next update. Modify the source org file instead. */\n\n"; while (<>) { - my ($dummy, $name, $code, $section, $type, $must, $may, $shouldnot, $mustnot, $encr) = split /\|/; + my ($dummy, $name, $code, $section, $type, $must, $may, $shouldnot, $mustnot, $encr) = split /\s*\|\s*/; next if ($name =~ m/Attribute Name/); - if ($name =~ m/ # (.*)/) { - print "\t/* $1 */\n"; + if ($name =~ m/# (.*)/) { + printf "\t/* %-60s */\n", $1; next; } - - $name =~ s/ *//g; - $code =~ s/ *//g; - $type =~ s/ *//g; + if ($name =~ m/\s/) { + die(sprintf("name '%s' contains space", $name)); + } print "\t/* $name */\n\t{\n\t\tstruct dict_avp_data data = {\n"; print "\t\t\t$code,\t/* Code */\n";