#!/usr/bin/env bash
case "$1" in
-*) cat << EOF >&2
Usage: [source] $(basename $0) [command [arguments ...]]

Set up environment variables for convenient access to the cross-compiling
toolchain targeting i386-pc-msdosdjgpp.
This allows you to invoke the toolchain utilities via their short names (eg.
'gcc'), access target-specific documentation via 'man' and 'info', and locate
target libraries via 'pkg-config'.

This script may be invoked in one of three ways:
 * With no arguments: starts a new shell.
 * With a command   : executes the specified command.
 * Via 'source'     : exports variables into the current shell (Bash only).
EOF
exit 1
;;
esac

export PATH="/usr/i386-pc-msdosdjgpp/local/bin:/usr/i386-pc-msdosdjgpp/bin:/usr/bin:$PATH"
export GCC_EXEC_PREFIX="/usr/lib/gcc/"
export MANPATH="/usr/i386-pc-msdosdjgpp/local/share/man:/usr/i386-pc-msdosdjgpp/share/man:/usr/share/man:$MANPATH"
export INFOPATH="/usr/i386-pc-msdosdjgpp/local/share/info:/usr/i386-pc-msdosdjgpp/share/info:/usr/share/info:$INFOPATH"
export PKG_CONFIG_LIBDIR="/usr/i386-pc-msdosdjgpp/local/lib/pkgconfig:/usr/i386-pc-msdosdjgpp/local/share/pkgconfig:/usr/i386-pc-msdosdjgpp/lib/pkgconfig:/usr/i386-pc-msdosdjgpp/share/pkgconfig"
unset PKG_CONFIG_PATH
export DJDIR="/usr/i386-pc-msdosdjgpp"
export WATT_ROOT="/usr/i386-pc-msdosdjgpp/watt"
if [ -z "$BASH_VERSION" ] || [ "${BASH_SOURCE[0]}" = "$0" ]; then
  if [ ! -z "$1" ]; then
    exec "$@"
  else
    echo 'Entering new shell for target environment: i386-pc-msdosdjgpp' >&2
    exec $SHELL
  fi
fi
echo 'Environment variables set up for target: i386-pc-msdosdjgpp' >&2
