Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwpl.git;a=commitdiff;h=24f047cc3647e82cd9e8e844800592250676ac42

commit 24f047cc3647e82cd9e8e844800592250676ac42
Author: James Buren <r...@frugalware.org>
Date:   Sun Oct 18 21:39:54 2009 -0500

sanitize-source-file.sh
* transform old strip-trailing-whitespace.sh
* initial draft, scans directories for source files
and strips trailing whitespace and ensures trailing newline

diff --git a/tools/sanitize-source-files.sh b/tools/sanitize-source-files.sh
new file mode 100755
index 0000000..8a7f0b4
--- /dev/null
+++ b/tools/sanitize-source-files.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Pattern to use
+PATTERN=".*\.(c|h|sh|p|pp|pas|cbi)"
+
+# Generate list of files
+FILES=`find -regextype 'posix-extended' -regex "${PATTERN}"`
+
+# Ensure trailing newline
+for f in ${FILES}; do
+       echo "w" | ed -s "${f}" &> /dev/null
+done
+
+# Strip trailing whitespace
+for f in ${FILES}; do
+       sed -i "s|\s*$||" "${f}" &> /dev/null
+done
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to