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