Lines Matching defs:dict
19 /* dict(3) generic dictionary manager
46 #include "dict.h"
51 static int dict_env_update(DICT *dict, const char *name, const char *value)
53 dict->error = 0;
58 if (dict->flags & DICT_FLAG_FOLD_FIX) {
59 if (dict->fold_buf == 0)
60 dict->fold_buf = vstring_alloc(10);
61 vstring_strcpy(dict->fold_buf, name);
62 name = lowercase(vstring_str(dict->fold_buf));
72 static const char *dict_env_lookup(DICT *dict, const char *name)
74 dict->error = 0;
79 if (dict->flags & DICT_FLAG_FOLD_FIX) {
80 if (dict->fold_buf == 0)
81 dict->fold_buf = vstring_alloc(10);
82 vstring_strcpy(dict->fold_buf, name);
83 name = lowercase(vstring_str(dict->fold_buf));
90 static void dict_env_close(DICT *dict)
92 if (dict->fold_buf)
93 vstring_free(dict->fold_buf);
94 dict_free(dict);
101 DICT *dict;
103 dict = dict_alloc(DICT_TYPE_ENVIRON, name, sizeof(*dict));
104 dict->lookup = dict_env_lookup;
105 dict->update = dict_env_update;
106 dict->close = dict_env_close;
107 dict->flags = dict_flags | DICT_FLAG_FIXED;
109 dict->fold_buf = vstring_alloc(10);
110 dict->owner.status = DICT_OWNER_TRUSTED;
111 return (DICT_DEBUG (dict));