debian experimental exim-daemon-heavy config
[exim.git] / test / src / loaded.c
CommitLineData
c55a77db
PH
1/* This is a test function for dynamic loading in Exim expansions. It uses the
2number of arguments to control the result. */
3
4/* These lines are taken from local_scan.h in the Exim source: */
5
6/* ========================================================================== */
7/* Return codes from the support functions lss_match_xxx(). These are also the
8codes that dynamically-loaded ${dlfunc functions must return. */
9
10#define OK 0 /* Successful match */
11#define DEFER 1 /* Defer - some problem */
12#define FAIL 2 /* Matching failed */
13#define ERROR 3 /* Internal or config error */
14
15/* Extra return code for ${dlfunc functions */
16
17#define FAIL_FORCED 4 /* "Forced" failure */
18/* ========================================================================== */
19
20
21int dltest(unsigned char **yield, int argc, unsigned char *argv[])
22{
23switch (argc)
24 {
25 case 0:
26 return ERROR;
27
28 case 1:
29 *yield = argv[0];
30 return OK;
31
32 case 2:
33 *yield = (unsigned char *)"yield FAIL_FORCED";
34 return FAIL_FORCED;
35
36 default:
37 *yield = (unsigned char *)"yield FAIL";
38 return FAIL;
39 }
40}