#!/bin/sh
#
# This file should only be run automatically by make, not directly by
# the user.
#
# This script is part of the SUIF version control system.  It takes
# one argument, a return code from the calling script.  If the return
# code is zero, the calling script was successful and the new
# versions.ver should be checked in.  If it is non-zero, there was an
# error, so the new versions.ver should be removed and the old one
# unlocked.

if (test ! "(" -d RCS ")" ) ; then
    echo "missing RCS directory" 1>&2
    exit 1
fi

if (test ${1} = 0) ; then
    chmod a+r versions.ver
    ci -q -m"AUTOMATIC: updated database" -t-"AUTOMATIC: version database" \
            versions.ver
    result=${?}
    if (test -f versions.ver) ; then
        rm -f versions.ver
    fi
    exit ${result}
else
    rm -f versions.ver
    rcs -u -q versions.ver
    exit ${1}
fi
