blob: 2e226b210947a004b8fbef809829f3182342d433 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/bin/sh -
#
# Check spelling in comments and quoted strings from the source files.
t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15
# Insulate against locale-specific sort order
LC_ALL=C
export LC_ALL
# If aspell has not been installed, quit
type aspell > /dev/null 2>&1 || {
echo 'skipped: aspell not found'
exit 0
}
# replace:
# Create a replacement list of spelling words.
replace() {
aspell --mode=ccpp --lang=en list < ../$1 |
sort -u |
comm -12 /dev/stdin s_string.ok
}
# check:
# Check the spelling of an individual file.
check() {
aspell --mode=ccpp --lang=en list < ../$1 |
sort -u |
comm -23 /dev/stdin s_string.ok > $t
test -s $t && {
echo "==== $1"
cat $t
}
}
# List of files to spellchk.
l=`(cd .. &&
find bench examples ext src test -name '*.[chisy]' &&
find src -name '*.in')`
usage()
{
echo 'usage: s_string [-r]' >&2
exit 1
}
while :
do case "$1" in
-r) # -r builds replacement list of OK words
for f in $l; do
replace $f
done | sort -u > $t
cp $t s_string.ok
shift;;
*)
test "$#" -eq 0 || usage
break;;
esac
done
for f in $l; do
check $f
done
exit 0
|