diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-27 14:24:02 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-27 14:24:02 +0000 |
commit | 343ba001ffb116ddadb275d23645861a60bbbdbc (patch) | |
tree | 300151e597f37ea8660f59819e47861b3036b23b /crawl-ref/source/util/pcre/Detrail | |
parent | 09f449f50d9f136fb7dd0dfb848ee953b2851aaf (diff) | |
download | crawl-ref-343ba001ffb116ddadb275d23645861a60bbbdbc.tar.gz crawl-ref-343ba001ffb116ddadb275d23645861a60bbbdbc.zip |
Added PCRE into the source tree. Updated documentation to reflect that PCRE is now on by default on Windows/DOS.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6696 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/util/pcre/Detrail')
-rw-r--r-- | crawl-ref/source/util/pcre/Detrail | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/util/pcre/Detrail b/crawl-ref/source/util/pcre/Detrail new file mode 100644 index 0000000000..1c5c7e9cae --- /dev/null +++ b/crawl-ref/source/util/pcre/Detrail @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +# This is a script for removing trailing whitespace from lines in files that +# are listed on the command line. + +# This subroutine does the work for one file. + +sub detrail { +my($file) = $_[0]; +my($changed) = 0; +open(IN, "$file") || die "Can't open $file for input"; +@lines = <IN>; +close(IN); +foreach (@lines) + { + if (/\s+\n$/) + { + s/\s+\n$/\n/; + $changed = 1; + } + } +if ($changed) + { + open(OUT, ">$file") || die "Can't open $file for output"; + print OUT @lines; + close(OUT); + } +} + +# This is the main program + +$, = ""; # Output field separator +for ($i = 0; $i < @ARGV; $i++) { &detrail($ARGV[$i]); } + +# End |