#! /bin/sh

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

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 gdomap -L GNUstepGSPasteboardServer | grep -c Found` = '0' ] && opentool gpbs

openapp "$app" "$@"
