r23597: add a few utility scripts for code formatting
authorGerald Carter <jerry@samba.org>
Mon, 25 Jun 2007 14:40:59 +0000 (14:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:34 +0000 (12:23 -0500)
(This used to be commit 3fc0bd3e540652742f5bdd7afa88d80b893e50cd)

source3/script/count_80_col.pl [new file with mode: 0755]
source3/script/strip_trail_ws.pl [new file with mode: 0755]

diff --git a/source3/script/count_80_col.pl b/source3/script/count_80_col.pl
new file mode 100755 (executable)
index 0000000..e1c8ff4
--- /dev/null
@@ -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 (executable)
index 0000000..c2c39e2
--- /dev/null
@@ -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 );
+
+