changeset 1433:3338f135989d

org_to_fd.pl: prevent spaces in AVP names
author Luke Mewburn <luke@mewburn.net>
date Wed, 19 Feb 2020 17:04:53 +1100
parents 38453a36d50d
children 8850d29960aa
files contrib/tools/org_to_fd.pl
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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";
"Welcome to our mercurial repository"