lkml.org 
[lkml]   [2010]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectstrip_whitespace.pl
I've written a new script called strip_whitespace.pl (included).

One bug is that, if you split or unsplit a string literal that
confuses it. Otherwise it seems to work.

strip_whitespace.pl drivers/staging/winbond/reg.c > before
apply patch
strip_whitespace.pl drivers/staging/winbond/reg.c > after

`diff before after`. If they are the same then resend the patch.

regards,
dan carpenter

#!/usr/bin/perl

use strict;

my $file = shift();
open FILE, "<$file";
my $txt = do { local $/; <FILE> };

# strip C99 comments
$txt =~ s/\/\/.*//g;
# strip newlines
$txt =~ s/\n//g;
# strip remaining comments
$txt =~ s/\/\*.*?\*\///g;
# strip tabs
$txt =~ s/\t//g;
# strip spaces
$txt =~ s/ //g;
# add newlines again
$txt =~ s/;/;\n/g;

print "$txt\n";


\
 
 \ /
  Last update: 2010-03-21 11:59    [W:0.081 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site