#! @SH@
#

# file: $ISIP_IFC/util/misc/rcs/isip_ci.sh
# version: $Id: isip_ci.sh 9611 2004-07-03 18:06:03Z picone $
#
# isip_ci checks in RCS files.  
# protection on the file is set to read-only.
# an external form for help is used.
#

# make sure that this directory is not managed by CVS
#
for arg do
   dir=`dirname $arg`;
   cvs_check=`ls $dir | grep CVS`;
   if (test "x$cvs_check" != "x") then

      # give the user an error message
      #
      echo "Files in this directory are managed by CVS, not RCS. Please read"
      echo "organizational policy on the proper use of revision control software."
      # report this infraction to help@isip
      #
      mail help@isip.msstate.edu <<EOF
Subject: CVS/RCS INFRACTION


User $USER tried to rcs the following file(s), one or more of which is
maintained by CVS:

  files = $*
  current directory = `pwd`

Please take appropriate action to preserve repository integrity.

-RCS/CVS watchdog
EOF

      exit 1
   fi
done

# check in file(s) with no-lock option set
#
ci -u $*

# unlock all checked-in files 
#  note: to catch files that didn't change and were aborted during check-in
#
rcs -u $* 2> /dev/null

# change mode to read-only for all files (skip any options)
#
for arg do
    if (test -f $arg) then
        chmod a-w $arg
    fi
done

# End
#
exit 0
