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"
15 /* These are not real lookup functions; they are just a way of testing the
16 rest of Exim by providing an easy way of specifying particular yields from
20 /*************************************************
22 *************************************************/
24 /* See local README for interface description. */
27 testdb_open(uschar *filename, uschar **errmsg)
29 filename = filename; /* Keep picky compilers happy */
31 return (void *)(1); /* Just return something non-null */
36 /*************************************************
38 *************************************************/
40 /* See local README for interface description. */
43 testdb_find(void *handle, uschar *filename, uschar *query, int length,
44 uschar **result, uschar **errmsg, BOOL *do_cache)
46 handle = handle; /* Keep picky compilers happy */
50 if (Ustrcmp(query, "fail") == 0)
52 *errmsg = US"testdb lookup forced FAIL";
53 DEBUG(D_lookup) debug_printf("%s\n", *errmsg);
56 if (Ustrcmp(query, "defer") == 0)
58 *errmsg = US"testdb lookup forced DEFER";
59 DEBUG(D_lookup) debug_printf("%s\n", *errmsg);
63 if (Ustrcmp(query, "nocache") == 0) *do_cache = FALSE;
65 *result = string_copy(query);
69 /* End of lookups/testdb.c */