#!/bin/csh -f
#
# check in _really_ unchanged (for when ci complains, and even ciu complains
#  about, say, rcsdiffs that are really just headers).
# NOTE: this one is the limit. If _this_ script complains, even after "optimum"
#  prompting, you should not try naked RCS commands as the locks can get
#  confused between multiple users etc. Just give up!
#
set progname = ciru

if !($#argv) then
  errecho "${progname}: usage: $progname <file>1+"
  exit 1
endif

set files = ($*)

foreach file ($files)
  echo "${file}: rcsdiff gives this:"
  rcsdiff $file
  if ($status == 2) then #error in rcsdiff (usually file is missing)
    errecho $progname aborted.
    # but don't exit!
  else #rcsdiff gave meaningful differences
    echo "==================================================================="
    echo -n "Are you sure these differences are acceptably trivial? [ny] "
    set response = "$<"
    if ("$response" == y) then
      echo "OK, checking in $file _really_ unchanged....."
      co -u -f -q $file
      if ($status) then
        errecho "$progname had problems: aborting. PLEASE don't take RCS's advice on checking in;"
        errecho " it is STRONGLY recommended you leave this file alone."
        # but don't exit!
      else
        errecho done.
      endif #of status of the naked co command
    endif #of response being yes
  endif #of status given by rcsdiff
end #foreach file
