]> hydra-www.ietfng.org Git - grade/commitdiff
Fix make-skeleton.pl
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Mon, 16 Feb 2015 05:24:47 +0000 (00:24 -0500)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 18 Feb 2015 00:53:42 +0000 (19:53 -0500)
make-skeleton.pl [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index cd1362e..9226b8b
@@ -14,6 +14,8 @@ sub comments() {
 }
 
 while(my $line = <STDIN>) {
+  chomp $line;
+
   # @section directive?
   if ($line =~ /^@(\S+)\s/) {
     comments() if defined $section;
@@ -25,14 +27,19 @@ while(my $line = <STDIN>) {
   elsif ($line =~ /^(:\S+)\s+/) {
     die "Directive not within section" if not defined $section;
     print "#$1\n";
+    while (my $cline = <STDIN>) { chomp $cline; last if $cline eq "."; }
   }
 
   # "#..." and not "#!..." get passed to template
-  elsif ($line =~ /^#(?!#)/) {
-    print $line;
+  elsif ($line =~ /^\s*#/) {
+    if ($line !~ /^\s*#!/) {
+      print "$line\n";
+    }
   }
 
-  else { die "Unknown line in definition file"; }
+  elsif ($line =~ /^\s*$/) { ; }
+
+  else { die "Unknown line in definition file ($line)"; }
 }
 
 die "No sections encountered" if not defined $section;