#! /bin/sh # Check that all files use at most 80 columns. set -e untabify() { perl -pe 's/^((.{8})*)\t/$1 /g; s/^(.(.{8})*)\t/$1 /g; s/^(..(.{8})*)\t/$1 /g; s/^(...(.{8})*)\t/$1 /g; s/^(....(.{8})*)\t/$1 /g; s/^(.....(.{8})*)\t/$1 /g; s/^(......(.{8})*)\t/$1 /g; s/^(.......(.{8})*)\t/$1 /g;' $1 } rm -f failures for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do find "$dir" \( -name "${1-*}.hh" -o -name "${1-*}.cc" \ -o -name "${1-*}.test" \) -a -type f -a -print | while read file; do x='........................................' if (untabify $file | grep -q $x.$x) 2>/dev/null; then if grep 'GNU Bison' "$file" >/dev/null || grep 'generated by flex' "$file" >/dev/null ; then : else echo "$file" >>failures fi fi done done if test -f failures; then echo "The following files contain lines with more than 80 characters:" cat failures rm failures exit 1; fi