#! /bin/sh
-# $Cambridge: exim/src/src/exinext.src,v 1.1 2004/10/07 10:39:01 ph10 Exp $
-# Copyright (c) 1996-2004 University of Cambridge.
+# Copyright (c) University of Cambridge, 1995 - 2007
# See the file NOTICE for conditions of use and distribution.
# Except when they appear in comments, the following placeholders in this
eximmacdef=
exim_path=
-if expr $1 : '\-' >/dev/null ; then
- while expr $1 : '\-' >/dev/null ; do
+if expr -- $1 : '\-' >/dev/null ; then
+ while expr -- $1 : '\-' >/dev/null ; do
if [ "$1" = "-C" ]; then
config=$2
shift
shift
- elif expr $1 : '\-D' >/dev/null ; then
+ elif expr -- $1 : '\-D' >/dev/null ; then
eximmacdef="$eximmacdef $1"
- if expr $1 : '\-DEXIM_PATH=' >/dev/null ; then
- exim_path=`expr $1 : '\-DEXIM_PATH=\(.*\)'`
+ if expr -- $1 : '\-DEXIM_PATH=' >/dev/null ; then
+ exim_path=`expr -- $1 : '\-DEXIM_PATH=\(.*\)'`
fi
shift
else
# suffixed file in each case.
set `awk -F: '{ for (i = 1; i <= NF; i++) print $i }' <<End
- CONFIGURE_FILE
- End
- `
+CONFIGURE_FILE
+End
+`
while [ "$config" = "" -a $# -gt 0 ] ; do
if [ -f "$1$hostsuffix" ] ; then
config="$1$hostsuffix"
# pick up routing delays after temporary recipient errors.
# Also add unqualified subject if it looks like a message id.
# 01-Apr-2004 Add the -C feature for testing
+# 22-Dec-2005 Complete the -C feature (!)
if [ "$argone" = "" ]; then
echo "Usage: exinext <address>|<domain>|<local-part>"
exit 1
fi
-perl - $exim_path "$eximmacdef" $argone $spool_directory $qualify_domain <<'End'
+perl - $exim_path "$eximmacdef" $argone $spool_directory $qualify_domain $config <<'End'
# Name the arguments
$subject = $ARGV[2];
$spool = $ARGV[3];
$qualify = $ARGV[4];
+ $config = $ARGV[5];
# If the subject doesn't contain an @ then construct an address
# for the domain, and ensure that in both cases the domain is
# Run Exim to get a list of hosts for the given domain; for
# each one construct the appropriate retry key.
- open(LIST, "$exim -v -bt $address |") ||
+ open(LIST, "$exim -C $config -v -bt $address |") ||
die "can't run exim to route $address";
while (<LIST>)