| 13999 |      1 | #!/usr/bin/perl -w
 | 
|  |      2 | 
 | 
|  |      3 | sub doit {
 | 
|  |      4 |     my ($file) = @_;
 | 
|  |      5 | 
 | 
|  |      6 |     open (FILE, $file) || die $!;
 | 
|  |      7 |     undef $/; $text = <FILE>; $/ = "\n";
 | 
|  |      8 |     close FILE || die $!;
 | 
|  |      9 | 
 | 
|  |     10 |     $_ = $text;
 | 
|  |     11 | 
 | 
|  |     12 |     s/text_raw\{\*([^*]|\*[^}])*\*\}//sg;       # actual work done here
 | 
|  |     13 |     s/text\{\*([^*]|\*[^}])*\*\}//sg;       # actual work done here
 | 
|  |     14 |     s/\(\*<\*\)//sg;
 | 
|  |     15 |     s/\(\*>\*\)//sg;
 | 
|  |     16 |     s/--(\ )*"([^"])*"//sg;
 | 
|  |     17 |     s/--(\ )*\{\*([^*]|\*[^}])*\*\}//sg;
 | 
|  |     18 | 
 | 
|  |     19 |     $result = $_;
 | 
|  |     20 | 
 | 
|  |     21 |     if ($text ne $result) {
 | 
|  |     22 |         print STDERR "fixing $file\n";
 | 
|  |     23 | #        if (! -f "$file~~") {
 | 
|  |     24 | #            rename $file, "$file~~" || die $!;
 | 
|  |     25 | #        }
 | 
|  |     26 |         open (FILE, "> Demo/$file") || die $!;
 | 
|  |     27 |         print FILE $result;
 | 
|  |     28 |         close FILE || die $!;
 | 
|  |     29 |     }
 | 
|  |     30 | }
 | 
|  |     31 | 
 | 
|  |     32 | 
 | 
|  |     33 | foreach $file (@ARGV) {
 | 
|  |     34 |   eval { &doit($file); };
 | 
|  |     35 |   if ($@) { print STDERR "*** doit $file: ", $@, "\n"; }
 | 
|  |     36 | }
 |