#!/bin/sh
# emacspeak - execute emacs with speech enhancements
[ -f /etc/emacspeak.conf ] && . /etc/emacspeak.conf
[ -z "$EMACS_BIN" ] && EMACS_BIN=/usr/bin/emacs

CL_ALL=""
for CL in $* ; do
	if [ "$CL" = "-o" ]; then
		DTK_PROGRAM=stereo-outloud
	elif [ "$CL" = "-m" ]; then
		DTK_PROGRAM=multispeech
	elif [ "$CL" = "-d" ]; then
		DTK_PROGRAM=dtk-soft
	else
		CL_ALL="$CL_ALL $CL"
	fi
done

export DTK_PROGRAM DTK_PORT DTK_DEVICE EMACS_BIN
[ -n "$DTK_TCL" ] && export DTK_TCL

EMACS_UNIBYTE=1
export EMACS_UNIBYTE

exec $EMACS_BIN -l /usr/share/emacs/site-lisp/emacspeak/lisp/emacspeak-setup.el $CL_ALL
