summaryrefslogtreecommitdiff
path: root/dist/s_whitespace
blob: 3a51b251bfec4c29f296b2faddb14678f7d166c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /bin/sh

# Single space and remove trailing whitespace from source files.
t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15

ws()
{
	sed -e 's/[	 ][	 ]*$//' \
	    -e '/^$/N' \
	    -e '/\n$/D' < $1 > $t
	cmp $t $1 > /dev/null 2>&1 || (echo "$1" && cp $t $1)
}

cd ..

for f in `find dist -name '*.py' -name 's_*'`; do
	ws $f
done

for f in `find examples ext src test \
    -name '*.[chi]' -o \
    -name '*.dox' -o \
    -name '*.in' -o \
    -name 'Makefile.am'`; do
	if expr "$f" : ".*/Makefile.in" > /dev/null; then
		continue
	fi
	ws $f
done