summaryrefslogtreecommitdiff
path: root/test/src/loaded.c
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2006-02-06 16:22:56 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2006-02-06 16:22:56 +0000
commitc55a77db55ebf46a399f136eeb3a928b1e862772 (patch)
treec732f478642b0066b751b1034e195a200b43f5c2 /test/src/loaded.c
parent151b83f867487080e8f0e5cd6179e857dc6b3ccb (diff)
CVSing the test suite.
Diffstat (limited to 'test/src/loaded.c')
-rw-r--r--test/src/loaded.c42
1 files changed, 42 insertions, 0 deletions
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;
+ }
+}