From d20976dcb3ce18e398bf9b8bd8171fc67fa7aada Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 28 Apr 2005 13:29:27 +0000 Subject: [PATCH] Make $value usable in the "else" part of ${run. --- doc/doc-txt/ChangeLog | 4 +++- doc/doc-txt/NewStuff | 5 ++++- src/src/expand.c | 12 +++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index cbb8e9cbb..c2a6c7711 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.128 2005/04/28 13:06:32 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.129 2005/04/28 13:29:27 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -263,6 +263,8 @@ PH/42 Exim no longer gives details of delivery errors for specific addresses in warning messages. There are also a few cases where bland messages such as "unrouteable address" or "local delivery error" are given. +PH/43 $value is now also set for the "else" part of a ${run expansion. + A note about Exim versions 4.44 and 4.50 ---------------------------------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index bd6f2e8c1..2df222c99 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.37 2005/04/27 13:29:32 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.38 2005/04/28 13:29:27 ph10 Exp $ New Features in Exim -------------------- @@ -167,6 +167,9 @@ PH/10 $message_linecount is a new variable that contains the total number of In the MAIL and RCPT ACLs, the value is zero because at that stage the message has not yet been received. +PH/11 In a ${run expansion, the variable $value (which contains the standard + output) is now also usable in the "else" string. + Version 4.50 ------------ diff --git a/src/src/expand.c b/src/src/expand.c index b1f7d3f96..49686555e 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.19 2005/04/27 13:29:32 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.20 2005/04/28 13:29:27 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2333,8 +2333,8 @@ if (yes) /* If this is called from a lookup or an extract, we want to restore $value to what it was at the start of the item, so that it has this value during the -second string expansion. For the call from "if" to this function, save_lookup -is set to lookup_value, so that this statement does nothing. */ +second string expansion. For the call from "if" or "run" to this function, +save_lookup is set to lookup_value, so that this statement does nothing. */ lookup_value = save_lookup; @@ -3330,7 +3330,6 @@ while (*s != 0) case EITEM_RUN: { FILE *f; - uschar *old_lookup_value = NULL; uschar *arg; uschar **argv; pid_t pid; @@ -3410,18 +3409,17 @@ while (*s != 0) in lookup_value). */ f = fdopen(fd_out, "rb"); - old_lookup_value = lookup_value; lookup_value = NULL; lookup_value = cat_file(f, lookup_value, &lsize, &lptr, NULL); fclose(f); } - /* Process the yes/no strings */ + /* Process the yes/no strings; $value may be useful in both cases */ switch(process_yesno( skipping, /* were previously skipping */ runrc == 0, /* success/failure indicator */ - old_lookup_value, /* value to reset for string2 */ + lookup_value, /* value to reset for string2 */ &s, /* input pointer */ &yield, /* output pointer */ &size, /* output size */ -- 2.30.2