/[man-db]/man-db/src/manp.c
ViewVC logotype

Diff of /man-db/src/manp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by cjwatson, Fri Aug 1 00:06:47 2003 UTC revision 1.32 by cjwatson, Fri Aug 1 21:07:39 2003 UTC
# Line 108  struct list { Line 108  struct list {
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
# Line 166  static struct list *iterate_over_list (s Line 167  static struct list *iterate_over_list (s
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;
# Line 215  const char **get_sections (void) Line 227  const char **get_sections (void)
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);
# Line 750  static void add_to_dirlist (FILE *config Line 763  static void add_to_dirlist (FILE *config
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)

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26