From c55a77db55ebf46a399f136eeb3a928b1e862772 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 6 Feb 2006 16:22:56 +0000 Subject: CVSing the test suite. --- test/src/loaded.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/src/loaded.c (limited to 'test/src/loaded.c') diff --git a/test/src/loaded.c b/test/src/loaded.c new file mode 100644 index 000000000..252738427 --- /dev/null +++ b/test/src/loaded.c @@ -0,0 +1,42 @@ +/* $Cambridge: exim/test/src/loaded.c,v 1.1 2006/02/06 16:24:05 ph10 Exp $ */ + +/* This is a test function for dynamic loading in Exim expansions. It uses the +number of arguments to control the result. */ + +/* These lines are taken from local_scan.h in the Exim source: */ + +/* ========================================================================== */ +/* Return codes from the support functions lss_match_xxx(). These are also the +codes that dynamically-loaded ${dlfunc functions must return. */ + +#define OK 0 /* Successful match */ +#define DEFER 1 /* Defer - some problem */ +#define FAIL 2 /* Matching failed */ +#define ERROR 3 /* Internal or config error */ + +/* Extra return code for ${dlfunc functions */ + +#define FAIL_FORCED 4 /* "Forced" failure */ +/* ========================================================================== */ + + +int dltest(unsigned char **yield, int argc, unsigned char *argv[]) +{ +switch (argc) + { + case 0: + return ERROR; + + case 1: + *yield = argv[0]; + return OK; + + case 2: + *yield = (unsigned char *)"yield FAIL_FORCED"; + return FAIL_FORCED; + + default: + *yield = (unsigned char *)"yield FAIL"; + return FAIL; + } +} -- cgit v1.2.3