File: SanityTestText

package info (click to toggle)
eximdoc4 4.89-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,068 kB
  • ctags: 47
  • sloc: perl: 867; makefile: 172; xml: 68; sh: 63
file content (36 lines) | stat: -rwxr-xr-x 729 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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