#!/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 optional argument, the label for the version.  If the argument
# is not given there is no effect.  If it is given, it is looked up in
# the version database and if it's there, an error message is given
# and an error code is returned.  Otherwise there is no effect.


if (test ${1}"" = "") ; then
    exit 0
fi

ver_database_ropen
if (test ${?} != 0) ; then
    exit 0
fi

if (grep "^"${1}":" versions.ver > /dev/null) ; then
    echo "version "${1}" already exists" 1>&2
    rm -f versions.ver
    exit 1
fi

rm -f versions.ver
exit ${?}
