#!/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 name of an attribute.  It writes to standard
# output the version numbers of all versions with that attribute.

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

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

awk '/^[0-9]/ {for (i = 2; i <= NF; ++i)
                   if ($i == "('${1}')")
                       print $1}' versions.ver | cut -f1 -d":"
if (test ${?} != 0) ; then
    rm -f versions.ver
    exit 1
fi

rm -f versions.ver
exit ${?}
