+## __mdw_programp NAME
+##
+## Does NAME exist as an executable program?
+__mdw_programp () { type -t >/dev/null "$1"; }
+
+###--------------------------------------------------------------------------
+### Other preliminaries.
+
+## Work out my home directory.
+##
+## This horrible trick resolves symbolic links. It enables resolving links,
+## changes directory and displays the name of the directory in a subshell to
+## avoid changing the current state.
+HOME=`(set -P; cd $HOME; pwd)`
+cd $HOME
+
+## Establish a temporary directory.
+[ "$TMPDIR" ] || eval `tmpdir -b`
+export TMP=$TMPDIR
+
+## CDE's session structure is demented and doesn't leave us with a proper
+## logout hook, so synthesize one here.
+[ -n "$DT" ] && trap "source $HOME/.bash_logout" EXIT
+
+###--------------------------------------------------------------------------
+### Set some basic paths.