if [ -x /bin/which ] ; then which=/bin/which
elif [ -x /usr/bin/which ] ; then which=/usr/bin/which
else which=which ; fi

dirname=`$which dirname`
[ -x "$dirname" ] || dirname=/bin/dirname
cfg="`$dirname \"$0\"`/config"

usage() {
        echo "Usage: $0 [ -h host] UUID" >&2
        exit 1
}

if [ "$1" = "-h" ] ; then
        shift

        if [ $# -ne 2 ] ; then
                usage
        fi

        host=$1 ; shift
        id=$1; shift

        . "$cfg"

        term "$sshicmd screen -S 'S$id' -x"
elif [ $# -eq 1 ] ; then
        id="$1" ; shift

        . "$cfg"

        term "screen -S 'S$id' -x"
else
        usage
fi
