view misc/util/update_headers.pl @ 7:dd4dce98151d

Added tag release_0_1 for changeset 1d2fe61a3a62
author Mikhail Kryshen <mikhail@kryshen.net>
date Fri, 07 Nov 2008 03:35:15 +0300
parents 6c41a0b43e58
children
line wrap: on
line source

#!/usr/bin/perl

use File::Find;

undef $/;

my $src = "../../src";
my $header_file = "header";

open (FILE, "$header_file");
my $header = <FILE>;
close(FILE);

find (\&update_header, $src);

sub update_header
{
   my $code;
   
   if ( $File::Find::name !~ /^.*\.java$/ )
   {
     return;
   }

   print $File::Find::name."\n";   
   open(FILE, "$_") or die "error opening file";
  
   $code = <FILE>;
   $code =~ s|(^[[:space:]]*/\*.*?\*/[[:space:]]*?\n\|^)|$header|s;
   
   close(FILE);

   open(FILE, ">$_") or die "error opening file";
   print FILE $code;
   close(FILE);
}