#!/bin/sh
## Emacsclient wrapper (emacsw)
##
## Launch emacsclient to handle a file if a server is already
## running. Otherwise launcher emacs. Should pass all arguments
## to emacsclient and be transparently invokeable as emacsclient
## except that stdout won't be displayed until emacsclient exits.
##
## Ethan Gold <etgold@cs.columbia.edu> 4/9/99
##

## server socket name
esock=/tmp/esrv${UID}-${HOSTNAME%%.*}
result="did nothing"
if [ -S $esock ]
then
    #echo "launching emacsclient"
    result=`emacsclient "$@"`
else
    #echo "launching emacs"
    result=`emacs "$@"`
fi
echo $result
exit
