#!/bin/sh
#
# Usage: launch_xemacs.sh <dateiname>
#
#
if [ $# -gt 0 ]
then    
#       try to start the gnuclient
        gnuclient -q "$@" 
        returnvalue=$?
#       was xemacs running in server mode?
        if [ $returnvalue -ne 2 -a $returnvalue -ne 0 ]
        then
#               no => start xemacs and gnuserv
                echo "xemacs -funcall gnuserv-start" "$@" "&"
                xemacs -funcall gnuserv-start "$@" &
        fi
else
        echo "Usage: " $0 " filename"
fi
