Tidy up "make" output along the lines of a 2.6 kernel make (just a short
[exim.git] / src / src / routers / rf_expand_data.c
CommitLineData
c988f1f4 1/* $Cambridge: exim/src/src/routers/rf_expand_data.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */
0756eb3c
PH
2
3/*************************************************
4* Exim - an Internet mail transport agent *
5*************************************************/
6
c988f1f4 7/* Copyright (c) University of Cambridge 1995 - 2005 */
0756eb3c
PH
8/* See the file NOTICE for conditions of use and distribution. */
9
10
11#include "../exim.h"
12#include "rf_functions.h"
13
14
15/*************************************************
16* Expand data string and handle errors *
17*************************************************/
18
19/* This little function is used by a couple of routers for expanding things. It
20just saves repeating this code too many times. It does an expansion, and
21chooses a suitable return code on error.
22
23Arguments:
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
27
28Returns: the expanded string, or NULL (with prc set) on failure
29*/
30
31uschar *
32rf_expand_data(address_item *addr, uschar *s, int *prc)
33{
34uschar *yield = expand_string(s);
35if (yield != NULL) return yield;
36if (expand_string_forcedfail)
37 {
38 DEBUG(D_route) debug_printf("forced failure for expansion of \"%s\"\n", s);
39 *prc = DECLINE;
40 }
41else
42 {
43 addr->message = string_sprintf("failed to expand \"%s\": %s", s,
44 expand_string_message);
45 *prc = DEFER;
46 }
47return NULL;
48}
49
50/* End of routers/rf_expand_data.c */