summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2007-06-25 14:40:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:34 -0500
commit9f4876c5867098c09095c6dc6305e3addf85a4ca (patch)
treed6a0d0b628bb6efcf71aea3f958b0135673fc213 /source3/script
parent78fcf93d88a1a786fb56a98ff043d217d62f406d (diff)
downloadsamba-9f4876c5867098c09095c6dc6305e3addf85a4ca.tar.gz
samba-9f4876c5867098c09095c6dc6305e3addf85a4ca.tar.bz2
samba-9f4876c5867098c09095c6dc6305e3addf85a4ca.zip
r23597: add a few utility scripts for code formatting
(This used to be commit 3fc0bd3e540652742f5bdd7afa88d80b893e50cd)
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/count_80_col.pl15
-rwxr-xr-xsource3/script/strip_trail_ws.pl18
2 files changed, 33 insertions, 0 deletions
diff --git a/source3/script/count_80_col.pl b/source3/script/count_80_col.pl
new file mode 100755
index 0000000000..e1c8ff46a2
--- /dev/null
+++ b/source3/script/count_80_col.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+
+open( INFILE, "$ARGV[0]" ) || die $@;
+
+$count = 0;
+while ( <INFILE> ) {
+ $count++ if (length($_) > 80);
+}
+
+close( INFILE );
+print "$ARGV[0]: $count lines > 80 characters\n" if ($count > 0);
+
+exit( 0 );
+
+
diff --git a/source3/script/strip_trail_ws.pl b/source3/script/strip_trail_ws.pl
new file mode 100755
index 0000000000..c2c39e21e3
--- /dev/null
+++ b/source3/script/strip_trail_ws.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+
+open( INFILE, "$ARGV[0]" ) || die $@;
+open( OUTFILE, ">$ARGV[0].new" ) || die $@;
+
+while ( <INFILE> ) {
+ $_ =~ s/[ \t\r]*$//;
+ print OUTFILE "$_";
+}
+
+close( INFILE );
+close( OUTFILE );
+
+rename( "$ARGV[0].new", "$ARGV[0]" ) || die @_;
+
+exit( 0 );
+
+