80columns.test 1 KB
Newer Older
1
2
3
4
5
6
7
8
#! /bin/sh

# Check that all files use at most 80 columns.

set -e

rm -f failures

9
10
11
LANG=en_US.UTF-8
export LANG

12
if [ "`echo '{r₁|r₂|r₃}' | wc -m`" != 11 ]; then
13
14
15
16
  LANG=C
  export LANG
  # The current locale does not grok unicode.
  # We still run this test, but only on lines that are purely ascii.
17
18
19
20
21
22
23
  x='[^	-~]' # This blank is a tab.
else
  x='.'
fi
x="$x$x$x$x$x$x$x$x$x" # 9x
x="$x$x$x$x$x$x$x$x$x" # 81x

24
25
for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do

26
27
28
  find "$dir" \(    -name "${1-*}.hh" \
                 -o -name "${1-*}.hxx" \
                 -o -name "${1-*}.cc" \
29
30
		 -o -name "${1-*}.test" \) -a -type f -a -print |
  while read file; do
31
     if (expand $file | grep -q $x) 2>/dev/null; then
32
33
34
35
36
37
38
39
	if grep 'GNU Bison' "$file" >/dev/null ||
	   grep 'generated by flex' "$file" >/dev/null ; then
	  :
	else
	  echo "$file" >>failures
	fi
     fi
  done
40
41
42
43
44
45
46
47
done

if test -f failures; then
   echo "The following files contain lines with more than 80 characters:"
   cat failures
   rm failures
   exit 1;
fi