summaryrefslogtreecommitdiff
path: root/doc/doc-docbook/SanityTestText
diff options
context:
space:
mode:
authorPhil Pennock <pdp@exim.org>2011-02-05 00:23:31 -0500
committerPhil Pennock <pdp@exim.org>2011-02-05 00:23:31 -0500
commitb32a971138c1120763af565a142787cf3175ced7 (patch)
treec62f15e783d5403c72b55bb57b796d52a8bccb66 /doc/doc-docbook/SanityTestText
parentbc19a55bf1d4db3a09f8030484faf8a824a9805d (diff)
Strip \x{c2} from .txt files and audit.
Am unable to keep the build process from inserting spurious \x{c2} characters into the created .txt files. Strip the characters in Tidytxt. Add SanityTestText to do a final audit for non-ASCII characters in the .txt files. Dependency: pcregrep if available, else uses Perl.
Diffstat (limited to 'doc/doc-docbook/SanityTestText')
-rwxr-xr-xdoc/doc-docbook/SanityTestText36
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/doc-docbook/SanityTestText b/doc/doc-docbook/SanityTestText
new file mode 100755
index 000000000..25b181e3d
--- /dev/null
+++ b/doc/doc-docbook/SanityTestText
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# Portability note:
+# This tool is only used in building spec.txt for a release, not used as
+# part of the normal build/install process, so only Maintainers are affected
+# by requirements here.
+
+filename="$1"
+
+if echo a | pcregrep -q a 2>/dev/null
+then
+ pcregrep -q '[^\x{20}-\x{7E}]' "$filename"
+ grepstatus=$?
+else
+ perl -ne 'BEGIN {$rv=1};END {exit $rv};
+ if (/[^\r\n\x{20}-\x{7E}]/) { $rv = 0; last }' < "$filename"
+ grepstatus=$?
+fi
+
+case $grepstatus in
+0)
+ echo >&2 "$0: found non-ASCII characters in $filename"
+ exit 1
+ ;;
+1)
+ exit 0
+ ;;
+2)
+ echo >&2 "$0: problem checking for non-ASCII characters in $filename"
+ exit 2
+ ;;
+*)
+ echo >&2 "$0: unhandled return value from pcregrep: $grepstatus"
+ exit 3
+ ;;
+esac