1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2009 */
6 /* See the file NOTICE for conditions of use and distribution. */
10 #include "rf_functions.h"
13 /*************************************************
14 * Expand data string and handle errors *
15 *************************************************/
17 /* This little function is used by a couple of routers for expanding things. It
18 just saves repeating this code too many times. It does an expansion, and
19 chooses a suitable return code on error.
22 addr the address that's being routed
23 s the string to be expanded
24 prc pointer to where to put the return code on failure
26 Returns: the expanded string, or NULL (with prc set) on failure
30 rf_expand_data(address_item *addr, uschar *s, int *prc)
32 uschar *yield = expand_string(s);
33 if (yield != NULL) return yield;
34 if (expand_string_forcedfail)
36 DEBUG(D_route) debug_printf("forced failure for expansion of \"%s\"\n", s);
41 addr->message = string_sprintf("failed to expand \"%s\": %s", s,
42 expand_string_message);
48 /* End of routers/rf_expand_data.c */