public
Description: Memcached -- you all use it. Get it here.
Homepage: http://www.danga.com/memcached/
Clone URL: git://github.com/dustin/memcached.git
Cosimo Streppone (author)
Thu Jun 19 08:29:10 -0700 2008
dustin (committer)
Thu Jun 19 08:29:10 -0700 2008
memcached / devtools / clean-whitespace.pl
100755 19 lines (18 sloc) 0.464 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use strict;
use FindBin qw($Bin);
chdir "$Bin/.." or die;
my @files = (glob("*.h"), glob("*.c"), glob("*.ac"));
foreach my $f (@files) {
    open(my $fh, $f) or die;
    my $before = do { local $/; <$fh>; };
    close ($fh);
    my $after = $before;
    $after =~ s/\t/ /g;
    $after =~ s/ +$//mg;
    $after .= "\n" unless $after =~ /\n$/;
    next if $after eq $before;
    open(my $fh, ">$f") or die;
    print $fh $after;
    close($fh);
}