#!/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 version.  It looks this label up in
# the version database and if it finds it, it lists all the source
# revisions and names for that version.


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

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

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

awk '/^[0-9]/ {FOUND=0} ; /^'${1}':/ {FOUND=1}
     /^    / {if (FOUND == 1) print "    "$1" "$2}' \
     versions.ver
if (test ${?} != 0) ; then
    rm -f versions.ver
    exit 1
fi

rm -f versions.ver
exit ${?}
