[planner] Added trailing white space stripping script



commit bc5d4457e0d1e2a936adc42a72f16271ece4c183
Author: Maurice van der Pot <griffon26 kfk4ever com>
Date:   Mon Jun 1 15:34:13 2009 +0200

    Added trailing white space stripping script
    
    The script in the "tools" subdirectory can be used to remove any
    trailing white space from planner's source files. Please use the sample
    pre-commit hook supplied with git so we won't ever have to use this
    script again.
---
 tools/strip_trailing_white_space.sh |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/tools/strip_trailing_white_space.sh b/tools/strip_trailing_white_space.sh
new file mode 100755
index 0000000..75b86cd
--- /dev/null
+++ b/tools/strip_trailing_white_space.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+if [ "$1" == "--help" ] || [ "$2" != "" ]; then
+	echo "Usage: $0 [options]"
+  echo ""
+	echo "This script searches the current directory and all directories below it"
+	echo "for *.c and *.h files and will remove any trailing white space."
+	echo ""
+	echo "Options:"
+	echo "  -c      Only check for and report trailing white space"
+	echo "  --help  Show usage information"
+	exit -1;
+elif [ "$1" == "-c" ]; then
+	echo "Searching for trailing white space..."
+	find . -name \*.[ch] -exec grep -nEH "[ 	]+$" {} \;
+	echo "done."
+else
+	echo "This script searches the current directory and all directories below it"
+	echo "for *.c and *.h files and will remove any trailing white space."
+	echo ""
+	echo -n "Are you sure you want to remove trailing white space (y/n)? "
+	read answer
+	if [ "$answer" == "y" ]; then
+		echo "Removing trailing white space..."
+		find . -name \*.[ch] -exec sed -i 's/[ \t]\+$//' {} \;
+		echo "done."
+	else
+		echo "Cancelled."
+	fi
+fi
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]