aboutsummaryrefslogtreecommitdiff
path: root/test/check-trailing-newlines.sh
blob: 4c99e76164ddc3fc38b45ab2754f3548e694e3c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

top_srcdir=${SOURCE_ROOT:-..}
. ${top_srcdir}/test/setup_env.sh

ebegin "Checking trailing newlines in code"
out=$(cd ${top_srcdir};
	for f in $(find */ -name '*.[ch]') ; do
		while read -r line; do
			if [ -n "${line}" ]; then
				blankline=
			else
				blankline=1
			fi
		done < "${f}"
		[ -n "${blankline}" ] && printf "%s\n" "${f}"
	done)
[ -z "${out}" ]
eend $? "Trailing newlines need to be deleted:"$'\n'"${out}"