#!/bin/ksh

if [ "X$1" = "X" ] ; then
  echo "Usage: $0 <comparedir>"
  echo
  echo "Example:  To see what needs to be installed:"
  echo "   # cd /newetc ; etcinst.sh /etc"
  echo
  echo "   To see what other files have been installed:"
  echo "   # cd /etc ; etcinst.sh /newetc"
  exit 1
fi

ETC=$1
export ETC

for f in * ; do
   if [ -d $f ] ; then
       echo "(DIR) : $f"
       continue;
   fi
   if [ ! -f $ETC/$f ] ; then
       echo "NEW   : $f"
   else
       if head -3 $f | grep "\$NetBSD" > /dev/null ; then
           head -3 $f > /tmp/$f.1.tmp
           head -3 $ETC/$f > /tmp/$f.2.tmp
           if ! cmp -s /tmp/$f.1.tmp /tmp/$f.2.tmp ; then
               # Headers are different.
               echo "CHANGE: $f"
           fi
       else
           if ! cmp -s $ETC/$f $f ; then
               echo "NORCS!: $f"
           else
               echo "NORCS : $f"
           fi
       fi
   fi
done

exit 0