blob: a60a75fa0758765acd8112bcfe65fd6293f00c8f (
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
|
#!/bin/sh
export LANG; LANG=C
: ${TMP=/tmp}
ID_idx=$TMP/ID.idx
ID_lid=$TMP/ID.lid
tmp_idx=$TMP/$$.idx
tmp_fid=$TMP/$$.fid
case $# in
0) 1>&2 echo Usage: $0 files...; exit 1;;
esac
case $1 in
-f*) idfile_arg=$1; shift;;
esac
errors=
if idx "$@" |sort -u >$ID_idx &&
lid $idfile_arg |sed -e 's/[ ].*//' |sort -u >$ID_lid &&
cmp -s $ID_idx $ID_lid
then
rm -f $ID_idx $ID_lid
echo "Good. idx and lid agree."
else
1>&2 echo "Oops! idx and lid disagree--look at $ID_idx and $ID_lid"
errors=t
fi
for file
do
case x$file in
x-*) scan_args="$scan_args $file"
continue;;
esac
if fid $idfile_arg $file >$tmp_fid &&
idx $scan_args $file |sort -u >$tmp_idx &&
cmp -s $tmp_idx $tmp_fid;
then
echo "Good. idx and fid agree for $file"
else
1>&2 echo "Oops! idx and fid disagree for $file"
errors=t
fi
done
rm -f $tmp_idx $tmp_fid
case x$errors in
xt) echo "Some checks failed."
echo "mkid and friends are broken--boo hoo!"
exit 1;;
*) echo "All checks successful."
echo "mkid and friends are happy!"
exit 0;;
esac
|