ceph/branches/riccardo/monitor2/script/adjusttabs.pl
riccardo80 07ac5d3e74 creating branch for distributed monitor
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1068 29311d96-e01e-0410-9327-a35deaab8ce9
2007-02-01 05:43:23 +00:00

25 lines
405 B
Perl
Executable File

#!/usr/bin/perl
my $tablen = shift @ARGV;
my $fn = shift @ARGV;
my $tab = ' ' x $tablen;
open(I, $fn);
my $f;
my $oldtab = ' ' x 4;
while (<I>) {
if (my ($oldlen) = /\-\*\- .*tab-width:(\d)/) {
print "old length was $oldlen\n";
$oldtab = ' ' x $oldlen;
s/tab-width:\d/tab-width:$tablen/;
}
s/\t/$oldtab/g;
$f .= $_;
}
close I;
open(O, ">$fn.new");
print O $f;
close O;
rename "$fn.new", $fn;