-# $Cambridge: exim/src/src/eximon.src,v 1.1 2004/10/07 10:39:01 ph10 Exp $
-
# Base source of start-up shell script for the Exim Monitor. Used to set the
# required environment variables before running the program. Using script
# rather than a configuration file means that computation can be done.
# The build process concatenates on the front of this various settings from
# os-specific files and from the user's configuration file.
-# Copyright (c) 2004 University of Cambridge.
+# Copyright (c) 2004 - 2012 University of Cambridge.
# See the file NOTICE for conditions of use and distribution.
# Except when they appear in comments, the following placeholders in this
# PROCESSED_FLAG
+# See if caller wants to invoke gdb
+
+use_gdb=''
+
+case ${1:-foo} in
+ gdb*) use_gdb="$1"; shift ;;
+esac
+
# Save arguments (can be the usual X parameters)
cmd_args="$@"
# Exec to the program we really want to run, thereby continuing in
# just the one process, and let it run in parallel with whatever
-# called this script.
+# called this script (unless gdb was requested in original $1).
-exec ${EXIMON_BINARY} $cmd_args &
+if [ "${use_gdb:-}" = "" ] ; then
+ exec "${EXIMON_BINARY}" $cmd_args &
+else
+ exec "$use_gdb" "${EXIMON_BINARY}" $cmd_args
+ # not backgrounded
+fi
# End