#!/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, the label for the new version.  It adds an entry to
# the version database of the current program for the new version
# number with all the current revisions of the source files.

if (test ${1}"" = "") ; then
    echo "no version specified" 1>&2
    exit 1
fi

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

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

echo ${1}: >> versions.ver

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

ver_list_current_revisions >> versions.ver

ver_database_wclose ${?}
exit ${?}
