1 /* $Cambridge: exim/src/src/routers/rf_expand_data.c,v 1.5 2009/11/16 19:50:38 nm4 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2009 */
8 /* See the file NOTICE for conditions of use and distribution. */
12 #include "rf_functions.h"
15 /*************************************************
16 * Expand data string and handle errors *
17 *************************************************/
19 /* This little function is used by a couple of routers for expanding things. It
20 just saves repeating this code too many times. It does an expansion, and
21 chooses a suitable return code on error.
24 addr the address that's being routed
25 s the string to be expanded
26 prc pointer to where to put the return code on failure
28 Returns: the expanded string, or NULL (with prc set) on failure
32 rf_expand_data(address_item
*addr
, uschar
*s
, int *prc
)
34 uschar
*yield
= expand_string(s
);
35 if (yield
!= NULL
) return yield
;
36 if (expand_string_forcedfail
)
38 DEBUG(D_route
) debug_printf("forced failure for expansion of \"%s\"\n", s
);
43 addr
->message
= string_sprintf("failed to expand \"%s\": %s", s
,
44 expand_string_message
);
50 /* End of routers/rf_expand_data.c */