1 // $Id: settings.c,v 1.1 2007-03-27 15:31:34 quinn Exp $
2 // This module implements a generic system of settings (attribute-value) that can
3 // be associated with search targets. The system supports both default values,
4 // per-target overrides, and per-user settings.
17 struct setting_dictionary
21 // Recursively read files in a directory structure, calling
22 static void read_settings(const char *path, void *context,
23 void (*fun)(void *context, struct setting *set))
27 static void prepare_dictionary(void *context, struct setting *set)
31 static void update_databases(void *context, struct setting *set)
35 // If we ever decide we need to be able to specify multiple settings directories,
36 // the two calls to read_settings must be split -- so the dictionary is prepared
37 // for the contents of every directory before the databases are updated.
38 void settings_read(const char *path)
40 struct setting_dictionary *new;
45 new = nmem_malloc(nmem, sizeof(*new));
46 memset(new, sizeof(*new), 0);
47 read_settings(path, new, prepare_dictionary);
48 read_settings(path, new, update_databases);
54 * indent-tabs-mode: nil
56 * vim: shiftwidth=4 tabstop=8 expandtab