Added internal-lirc-backend and stuff.
[irreco.git] / script / strip-trailing-whitespace.sh
blobbbe0b2c0cf0f0c7406cba95e1478510f72af6265
1 #!/bin/bash
2 cd `dirname "$0"`
4 strip_whitespace()
6 COUNT=0
7 while read FILE; do
8 echo "Stripping whitespaces from: $FILE"
9 sed -i -r -e 's|[ \t]+$||' $FILE
10 ((COUNT++))
11 done
12 echo "Stripped whitespaces from $COUNT files."
15 if [ "$1" = '--all' ]; then
16 find ../ -type f -regex '.*\.[ch]' > tmp/tmp_file
17 find ../ -type f -regex '.*\.php' >> tmp/tmp_file
18 cat tmp/tmp_file \
19 | xargs -d '\n' egrep -l '[[:space:]]+$' \
20 | strip_whitespace
21 rm tmp/tmp_file
22 elif [ -f "$1" ]; then
23 echo "$1" | strip_whitespace
24 else
25 echo "Usage: $0 FILENAME | --all"