1 /* $Cambridge: exim/src/src/lookups/testdb.c,v 1.5 2009/11/16 19:50:38 nm4 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2009 */
8 /* See the file NOTICE for conditions of use and distribution. */
11 #include "lf_functions.h"
14 /* These are not real lookup functions; they are just a way of testing the
15 rest of Exim by providing an easy way of specifying particular yields from
19 /*************************************************
21 *************************************************/
23 /* See local README for interface description. */
26 testdb_open(uschar
*filename
, uschar
**errmsg
)
28 filename
= filename
; /* Keep picky compilers happy */
30 return (void *)(1); /* Just return something non-null */
35 /*************************************************
37 *************************************************/
39 /* See local README for interface description. */
42 testdb_find(void *handle
, uschar
*filename
, uschar
*query
, int length
,
43 uschar
**result
, uschar
**errmsg
, BOOL
*do_cache
)
45 handle
= handle
; /* Keep picky compilers happy */
49 if (Ustrcmp(query
, "fail") == 0)
51 *errmsg
= US
"testdb lookup forced FAIL";
52 DEBUG(D_lookup
) debug_printf("%s\n", *errmsg
);
55 if (Ustrcmp(query
, "defer") == 0)
57 *errmsg
= US
"testdb lookup forced DEFER";
58 DEBUG(D_lookup
) debug_printf("%s\n", *errmsg
);
62 if (Ustrcmp(query
, "nocache") == 0) *do_cache
= FALSE
;
64 *result
= string_copy(query
);
69 /*************************************************
70 * Version reporting entry point *
71 *************************************************/
73 /* See local README for interface description. */
75 #include "../version.h"
78 testdb_version_report(FILE *f
)
81 fprintf(f
, "Library version: TestDB: Exim version %s\n", EXIM_VERSION_STR
);
86 static lookup_info _lookup_info
= {
87 US
"testdb", /* lookup name */
88 lookup_querystyle
, /* query-style lookup */
89 testdb_open
, /* open function */
90 NULL
, /* check function */
91 testdb_find
, /* find function */
92 NULL
, /* no close function */
93 NULL
, /* no tidy function */
94 NULL
, /* no quoting function */
95 testdb_version_report
/* version reporting */
99 #define testdb_lookup_module_info _lookup_module_info
102 static lookup_info
*_lookup_list
[] = { &_lookup_info
};
103 lookup_module_info testdb_lookup_module_info
= { LOOKUP_MODULE_INFO_MAGIC
, _lookup_list
, 1 };
105 /* End of lookups/testdb.c */