[Kstars-devel] whitespace: worth fixing?

James Bowlin bowlin at mindspring.com
Sat Sep 22 01:50:38 CEST 2007


On Fri September 21 2007, Jason Harris wrote:
> I ran the ruby script I got from a KDE dev on skymapevents.cpp as a test.
> It bombed out on a large switch() block, so it looks like the case-align
> code isn't bulletproof.

Here is a two line Perl script that will do the tab expansion:

#!/usr/bin/perl -p -i.bak
s/\t/    /g;

This version will create backup files with .bak appended to the filename.
If you don't want backups remove ".bak" from the first line (but leave
in the -i which tells Perl to edit the files in-place).

Simply copy the two lines into a file (no leading blank line, no leading
space before the #!), call it expand.pl for example then run it like:

$ chmod a+x expand.pl
$ ./expand.pl *.cpp *.h

It needs the -p and -i Perl options for it to run correctly so it's
best to use the chmod command to make the script executable.

It does not bomb out but it is very fast so you might think it didn't
run if you don't use backup files.


-- 
Peace, James


More information about the Kstars-devel mailing list