1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00
cc65/.github/checks/lastline.sh
Greg King 6ea1f8ee85 Made the style-check scripts send their file lists to stderr.
A complete list will be shown before make shows its error message.  There will be less confusion about which lines are in the list.
2022-04-18 19:47:02 -04:00

26 lines
559 B
Bash
Executable File

#! /bin/bash
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_PATH=.
cd $SCRIPT_PATH/../../
nl='
'
nl=$'\n'
r1="${nl}$"
FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | while read f; do
t=$(tail -c2 $f; printf x)
[[ ${t%x} =~ $r1 ]] || echo "$f"
done`
cd $OLDCWD
if [ x"$FILES"x != xx ]; then
echo "error: found following files that have no newline at the end:" >&2
for n in $FILES; do
echo $n >&2
done
exit -1
fi