summaryrefslogtreecommitdiffstats
path: root/src/script/add_header.pl
blob: 023c06e455fd11bc9441f3c8c81e951b4fae9b6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

use strict;
my $fn = shift @ARGV;
my $old = `cat $fn`;

my $header = `cat doc/header.txt`;

# strip existing header
my $new = $old;
if ($new =~ /^(.*)\* Ceph - scalable distributed file system/s) {
	my ($a,@b) = split(/\*\/\n/, $new);
	$new = join("*/\n",@b);
}
$new = $header . $new;

if ($new ne $old) {
	open(O, ">$fn.new");
	print O $new;
	close O;
	system "diff $fn $fn.new";
	rename "$fn.new", $fn;
	#unlink "$fn.new";

}