~singpolyma/cheogram-smtp

ref: 06e954292339d5569db11c456447e8fd72f1d6c0 cheogram-smtp/bin/line-check -rwxr-xr-x 362 bytes
06e95429Stephen Paul Weber Add install instructions to README 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

TABWIDTH=8
LINEMAX=80

filename="$1"
lineno=0
expand -t$TABWIDTH < "$filename" | while IFS="" read -r line; do
	lineno=$(( lineno + 1 ))
	if [ "${#line}" -le "$LINEMAX" ]; then
		continue
	fi

	printf "%s:%d: Line length is %d which is greater than max of %d\\n" \
		"$filename" "$lineno" "${#line}" "$LINEMAX" 1>&2
	printf " %s\\n" "$line" 1>&2
done