summaryrefslogtreecommitdiffstats
path: root/idtest
blob: a75511e91b7d07f75ae22ee6ef84f4fe72fbd2d5 (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
#!/bin/sh

case $# in
0) 1>&2 echo Usage: $0 files...; exit 1;;
esac
case $1 in
-f*) idfile_arg=$1; shift;;
esac

errors=

echo "idx ..."
idx "$@" |sort -u >ID.idx
echo "lid ..."
lid $idfile_arg |sed -e 's/[ 	].*//' |sort -u >ID.lid
if 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 in ID.idx and ID.lid"
    errors=t
fi

idx_file=$$.idx
fid_file=$$.fid

for file
do
    case x$file in
    x-*) scan_args="$scan_args $file"
	 continue;;
    esac
    fid $idfile_arg $file >$fid_file
    idx $scan_args $file |sort -u >$idx_file
    if cmp -s $idx_file $fid_file; 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 $idx_file $fid_file

case x$errors in
xt) 1>&2 echo "mkid and friends are broken."; exit 1;;
*) echo "mkid and friends are happy."; exit 0;;
esac