set -e
editor=${MDW_EDITOR-ed}
+[ -t 0 -a -t 1 ] || TERM=dumb
case "$EDITOR,$VISUAL,$TERM" in
mdw-editor,mdw-editor,dumb) editor=gnuclient;;
mdw-editor,mdw-editor,*);;
- *,mdw-editor,*) editor=$EDITOR;;
mdw-editor,*,*) editor=$VISUAL;;
+ *,*,*) editor=$EDITOR;;
esac
exec $editor "$@"