From b5ca8e4f1a2161d4cfeab815858cb085fe4eef45 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Fri, 15 Oct 2004 17:29:47 +0000 Subject: [PATCH] Update to the latest mailnotify script from gary@gnu.org--2004/cvs-utils--tla--1.0: * config/mailnotify.m4sh: Fix bugs in sendmail search and for loop invocations. --- ChangeLog | 8 ++++++++ config/mailnotify.m4sh | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fe5a3d1e..2428ae348 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-10-15 Gary V. Vaughan + + Update to the latest mailnotify script from + gary@gnu.org--2004/cvs-utils--tla--1.0: + + * config/mailnotify.m4sh: Fix bugs in sendmail search and + for loop invocations. + 2004-10-14 Peter O'Gorman * config/ltmain.m4sh: Revert most of my last commit, only eval diff --git a/config/mailnotify.m4sh b/config/mailnotify.m4sh index 894a5b47c..7160893b6 100644 --- a/config/mailnotify.m4sh +++ b/config/mailnotify.m4sh @@ -60,6 +60,7 @@ m4_divert_push([SCRIPT])#!/bin/sh : ${TMPDIR=/tmp} : ${HOST=`hostname`} +: ${SENDMAIL=sendmail} PROGRAM=mailnotify @@ -285,13 +286,17 @@ func_sendmail () from_name=`echo "$my_from" | sed 's, *<.*> *$,,;s,",,g'` from_addr=`echo "$my_from" | sed "$sed_mail_address"` - SENDMAIL=sendmail - for try_sendmail in sendmail /usr/lib/sendmail /usr/sbin/sendmail; do - if which $try_sendmail >/dev/null 2>&1; then - SENDMAIL=$try_sendmail + save_IFS="$IFS" + IFS=':' + for try_sendmail_dir in /usr/lib:/usr/sbin:$PATH; do + IFS="$save_IFS" + if test -x "$try_sendmail_dir/$SENDMAIL"; then + SENDMAIL="$try_sendmail_dir/$SENDMAIL" break fi done + IFS="$save_IFS" + test -x "$SENDMAIL" || func_fatal_error "sendmail executable not found" func_verbose "Delivering mail, please wait..." if test -n "$from_name"; then @@ -320,8 +325,10 @@ func_sendmail () trap 'rm -f "$fname"; exit 1' 1 2 15 destination="" - for to; + for to in : ${1+"$@"} do + test "X$to" = X: && continue + case $destination in "") destination="$to" ;; *) destination="$destination, $to" ;; @@ -337,7 +344,10 @@ func_sendmail () if test -z "$outputfile"; then destination="" - for to; do + for to in : ${1+"$@"} + do + test "X$to" = X: && continue + to_addr=`echo "$to" | sed "$sed_mail_address"` test -n "$to_addr" || to_addr="$to" destination="$destination $to_addr" -- 2.47.2