No empty .Rs/.Re
[netbsd-mini2440.git] / share / man / tools / mcmp
blob2ef10d364a1c354eb806d46a3626cc89059c2209
1 set x $*
2 . ./.param
4 if test -z "$ID"
5 then
6         DIR2=/usr/nman
7 else
8         DIR2=$ID
9 fi
11 if test ! -d $DIR2
12 then
13         echo "mcmp: $DIR2 - not a directory"
14         exit
17 for dir in $DIRLST
19         date > $TMPDIR/tmp3.$$
20         echo >> $TMPDIR/tmp3.$$
21         cd $MANDIR/man$dir
22         echo "Comparison of $MANDIR/man$dir and $DIR2/man$dir:">>$TMPDIR/tmp3.$$
23         echo >> $TMPDIR/tmp3.$$
24         ls $FILLST > $TMPDIR/tmp1.$$
25         cd $DIR2/man$dir
26         ls $FILLST > $TMPDIR/tmp2.$$
27         cd $MANDIR/man$dir
28         echo "Files found in $MANDIR/man$dir only:" >> $TMPDIR/tmp3.$$
29         comm -23 $TMPDIR/tmp1.$$ $TMPDIR/tmp2.$$ | sed "s/^/    /" >> $TMPDIR/tmp3.$$
30         echo >> $TMPDIR/tmp3.$$
31         echo "Files found in $DIR2/man$dir only:" >> $TMPDIR/tmp3.$$
32         comm -13 $TMPDIR/tmp1.$$ $TMPDIR/tmp2.$$ | sed "s/^/    /" >> $TMPDIR/tmp3.$$
33         echo >> $TMPDIR/tmp3.$$
34         comm -12 $TMPDIR/tmp1.$$ $TMPDIR/tmp2.$$ > $TMPDIR/tmp.$$
35         rm -f $TMPDIR/tmp1.$$ $TMPDIR/tmp2.$$
36         if [ ! -s $TMPDIR/tmp.$$ ]
37         then
38                 echo "No common files for comparison" >> $TMPDIR/tmp3.$$
39                 if [ -n "$LFLAG" ]
40                 then
41                         mv $TMPDIR/tmp3.$$ $TMPDIR/diff$dir
42                 else
43                         mv $TMPDIR/tmp3.$$ $TMPDIR/cmp$dir
44                 fi
45                 continue
46         fi
47         if [ -n "$LFLAG" ]
48         then
49                 mv $TMPDIR/tmp3.$$ $TMPDIR/diff$dir
50                 echo "Diffs of common files ($MANDIR=< $DIR2=>):" >> $TMPDIR/diff$dir
51         else
52                 mv $TMPDIR/tmp3.$$ $TMPDIR/cmp$dir
53                 echo "Files that differ:" >> $TMPDIR/cmp$dir
54         fi
55         while read file
56         do
57                 if [ -z "$LFLAG" ]
58                 then
59                         cmp -s $file $DIR2/man$dir/$file
60                         if [ $? -ne 0 ]
61                         then
62                                 echo "\\t$file" >> $TMPDIR/cmp$dir
63                         fi
64                 else
65                         diff $file $DIR2/man$dir/$file > $TMPDIR/tmp1.$$
66                         if [ $? -eq 1 ]
67                         then
68                                 echo "\\n\\t****$file****" >> $TMPDIR/diff$dir
69                                 cat $TMPDIR/tmp1.$$ >> $TMPDIR/diff$dir
70                         fi
71                 fi
72         done < $TMPDIR/tmp.$$
73         rm -f $TMPDIR/tmp1.$$
74 done
76 rm -f $TMPDIR/tmp.$$