160
160
/* dict_unix_open - open UNIX map */
162
DICT *dict_unix_open(const char *map, int unused_flags, int dict_flags)
162
DICT *dict_unix_open(const char *map, int open_flags, int dict_flags)
164
164
DICT_UNIX *dict_unix;
165
165
struct dict_unix_lookup {
174
174
struct dict_unix_lookup *lp;
179
if (open_flags != O_RDONLY)
180
return (dict_surrogate(DICT_TYPE_UNIX, map, open_flags, dict_flags,
181
"%s:%s map requires O_RDONLY access mode",
182
DICT_TYPE_UNIX, map));
178
dict_unix = (DICT_UNIX *) dict_alloc(DICT_TYPE_UNIX, map,
185
* "Open" the database.
180
187
for (lp = dict_unix_lookup; /* void */ ; lp++) {
181
188
if (lp->name == 0)
182
msg_fatal("dict_unix_open: unknown map name: %s", map);
189
return (dict_surrogate(DICT_TYPE_UNIX, map, open_flags, dict_flags,
190
"unknown table: %s:%s", DICT_TYPE_UNIX, map));
183
191
if (strcmp(map, lp->name) == 0)
194
dict_unix = (DICT_UNIX *) dict_alloc(DICT_TYPE_UNIX, map,
186
196
dict_unix->dict.lookup = lp->lookup;
187
197
dict_unix->dict.close = dict_unix_close;
188
198
dict_unix->dict.flags = dict_flags | DICT_FLAG_FIXED;
189
199
if (dict_flags & DICT_FLAG_FOLD_FIX)
190
200
dict_unix->dict.fold_buf = vstring_alloc(10);
201
dict_unix->dict.owner.status = DICT_OWNER_TRUSTED;
192
203
return (DICT_DEBUG (&dict_unix->dict));