108 |
|
|
109 |
static struct list *namestore, *tailstore; |
static struct list *namestore, *tailstore; |
110 |
|
|
111 |
#define SECTION -4 |
#define SECTION -5 |
112 |
|
#define DEFINE_USER -4 |
113 |
#define DEFINE -3 |
#define DEFINE -3 |
114 |
#define MANDB_MAP_USER -2 |
#define MANDB_MAP_USER -2 |
115 |
#define MANDB_MAP -1 |
#define MANDB_MAP -1 |
167 |
return NULL; |
return NULL; |
168 |
} |
} |
169 |
|
|
170 |
|
/* Must not return DEFINEs set in ~/.manpath. This is used to fetch |
171 |
|
* definitions used in raised-privilege code; if in doubt, be conservative! |
172 |
|
*/ |
173 |
const char *get_def (const char *thing, const char *def) |
const char *get_def (const char *thing, const char *def) |
174 |
{ |
{ |
175 |
const char *config_def = get_from_list (thing, DEFINE); |
const char *config_def = get_from_list (thing, DEFINE); |
176 |
return config_def ? config_def : def; |
return config_def ? config_def : def; |
177 |
} |
} |
178 |
|
|
179 |
|
const char *get_def_user (const char *thing, const char *def) |
180 |
|
{ |
181 |
|
const char *config_def = get_from_list (thing, DEFINE_USER); |
182 |
|
if (!config_def) |
183 |
|
config_def = get_from_list (thing, DEFINE); |
184 |
|
return config_def ? config_def : def; |
185 |
|
} |
186 |
|
|
187 |
static void print_list (void) |
static void print_list (void) |
188 |
{ |
{ |
189 |
struct list *list; |
struct list *list; |
227 |
return sections; |
return sections; |
228 |
} |
} |
229 |
|
|
230 |
static void add_def (char *thing, char *config_def, int flag) |
static void add_def (char *thing, char *config_def, int flag, int user) |
231 |
{ |
{ |
232 |
add_to_list (thing, flag == 2 ? config_def : "", DEFINE); |
add_to_list (thing, flag == 2 ? config_def : "", |
233 |
|
user ? DEFINE_USER : DEFINE); |
234 |
|
|
235 |
if (debug) |
if (debug) |
236 |
fprintf (stderr, "Defined `%s' as `%s'.\n", thing, config_def); |
fprintf (stderr, "Defined `%s' as `%s'.\n", thing, config_def); |
763 |
add_mandb_map (key, cont, c, user); |
add_mandb_map (key, cont, c, user); |
764 |
else if ((c = sscanf (bp, "DEFINE %49s %511[^\n]", |
else if ((c = sscanf (bp, "DEFINE %49s %511[^\n]", |
765 |
key, cont)) > 0) |
key, cont)) > 0) |
766 |
add_def (key, cont, c); |
add_def (key, cont, c, user); |
767 |
else if (sscanf (bp, "SECTION %511[^\n]", cont) == 1) |
else if (sscanf (bp, "SECTION %511[^\n]", cont) == 1) |
768 |
add_sections (cont); |
add_sections (cont); |
769 |
else if (sscanf (bp, "SECTIONS %511[^\n]", cont) == 1) |
else if (sscanf (bp, "SECTIONS %511[^\n]", cont) == 1) |