#! /bin/sh

tool=$(basename "$0")
if [ $tool = "gnustep-tool-wrapper" ]; then
    cat - <<EOF
gnustep-tool-wrapper: This script is a wrapper script for GNUstep tools,
and is not meant to be called directly.
EOF
    exit 1
fi

opentool=/usr/lib/GNUstep/System/Tools/opentool

if [ -z "$GNUSTEP_MAKEFILES" ]; then
    . /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh
fi

[ `$opentool gdomap -L GDNCServer | grep -c Found` = '0' ] && $opentool gdnc

$opentool "$tool" "$@"
