Docs: clarify logging from filter
[exim.git] / doc / doc-docbook / SanityTestText
1 #!/bin/sh
2
3 # Portability note:
4 # This tool is only used in building spec.txt for a release, not used as
5 # part of the normal build/install process, so only Maintainers are affected
6 # by requirements here.
7
8 filename="$1"
9
10 if echo a | pcregrep -q a 2>/dev/null
11 then
12 pcregrep -q '[^\x{20}-\x{7E}]' "$filename"
13 grepstatus=$?
14 else
15 perl -ne 'BEGIN {$rv=1};END {exit $rv};
16 if (/[^\r\n\x{20}-\x{7E}]/) { $rv = 0; last }' < "$filename"
17 grepstatus=$?
18 fi
19
20 case $grepstatus in
21 0)
22 echo >&2 "$0: found non-ASCII characters in $filename"
23 exit 1
24 ;;
25 1)
26 exit 0
27 ;;
28 2)
29 echo >&2 "$0: problem checking for non-ASCII characters in $filename"
30 exit 2
31 ;;
32 *)
33 echo >&2 "$0: unhandled return value from pcregrep: $grepstatus"
34 exit 3
35 ;;
36 esac