No empty .Rs/.Re
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / util / dict_static.c
blobf905df1f1126a7f256878826b7e7a10c84253eac
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* dict_static 3
6 /* SUMMARY
7 /* dictionary manager interface to static variables
8 /* SYNOPSIS
9 /* #include <dict_static.h>
11 /* DICT *dict_static_open(name, dummy, dict_flags)
12 /* const char *name;
13 /* int dummy;
14 /* int dict_flags;
15 /* DESCRIPTION
16 /* dict_static_open() implements a dummy dictionary that returns
17 /* as lookup result the dictionary name, regardless of the lookup
18 /* key value.
20 /* The \fIdummy\fR argument is ignored.
21 /* SEE ALSO
22 /* dict(3) generic dictionary manager
23 /* LICENSE
24 /* .ad
25 /* .fi
26 /* The Secure Mailer license must be distributed with this software.
27 /* AUTHOR(S)
28 /* jeffm
29 /* ghostgun.com
30 /*--*/
32 /* System library. */
34 #include "sys_defs.h"
35 #include <stdio.h> /* sprintf() prototype */
36 #include <stdlib.h>
37 #include <unistd.h>
38 #include <string.h>
40 /* Utility library. */
42 #include "mymalloc.h"
43 #include "msg.h"
44 #include "dict.h"
45 #include "dict_static.h"
47 /* dict_static_lookup - access static value*/
49 static const char *dict_static_lookup(DICT *dict, const char *unused_name)
51 dict_errno = 0;
53 return (dict->name);
56 /* dict_static_close - close static dictionary */
58 static void dict_static_close(DICT *dict)
60 dict_free(dict);
63 /* dict_static_open - make association with static variable */
65 DICT *dict_static_open(const char *name, int unused_flags, int dict_flags)
67 DICT *dict;
69 dict = dict_alloc(DICT_TYPE_STATIC, name, sizeof(*dict));
70 dict->lookup = dict_static_lookup;
71 dict->close = dict_static_close;
72 dict->flags = dict_flags | DICT_FLAG_FIXED;
73 return (DICT_DEBUG (dict));