[BACK]Return to manpath.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/manpath.c between version 1.24 and 1.26

version 1.24, 2015/04/28 16:13:45 version 1.26, 2015/06/10 19:26:13
Line 29 
Line 29 
 #include "mandoc_aux.h"  #include "mandoc_aux.h"
 #include "manconf.h"  #include "manconf.h"
   
   #if !HAVE_MANPATH
 static  void     manconf_file(struct manconf *, const char *);  static  void     manconf_file(struct manconf *, const char *);
   #endif
 static  void     manpath_add(struct manpaths *, const char *, int);  static  void     manpath_add(struct manpaths *, const char *, int);
 static  void     manpath_parseline(struct manpaths *, char *, int);  static  void     manpath_parseline(struct manpaths *, char *, int);
   
Line 84  manconf_parse(struct manconf *conf, const char *file,
Line 86  manconf_parse(struct manconf *conf, const char *file,
         free(buf);          free(buf);
         pclose(stream);          pclose(stream);
 #else  #else
         char             manpath_default[] = MANPATH_DEFAULT;  
         char            *insert;          char            *insert;
   
         /* Always prepend -m. */          /* Always prepend -m. */
Line 104  manconf_parse(struct manconf *conf, const char *file,
Line 105  manconf_parse(struct manconf *conf, const char *file,
         /* No MANPATH; use man.conf(5) only. */          /* No MANPATH; use man.conf(5) only. */
         if (NULL == defp || '\0' == defp[0]) {          if (NULL == defp || '\0' == defp[0]) {
                 manconf_file(conf, file);                  manconf_file(conf, file);
                 if (conf->manpath.sz == 0)  
                         manpath_parseline(&conf->manpath, manpath_default, 0);  
                 return;                  return;
         }          }
   
Line 206  manconf_free(struct manconf *conf)
Line 205  manconf_free(struct manconf *conf)
         free(conf->output.style);          free(conf->output.style);
 }  }
   
   #if !HAVE_MANPATH
 static void  static void
 manconf_file(struct manconf *conf, const char *file)  manconf_file(struct manconf *conf, const char *file)
 {  {
         const char *const toks[] = { "manpath", "output", "_whatdb" };          const char *const toks[] = { "manpath", "output", "_whatdb" };
           char manpath_default[] = MANPATH_DEFAULT;
   
         FILE            *stream;          FILE            *stream;
         char            *cp, *ep;          char            *cp, *ep;
         size_t           len, tok;          size_t           len, tok;
   
         if ((stream = fopen(file, "r")) == NULL)          if ((stream = fopen(file, "r")) == NULL)
                 return;                  goto out;
   
         while ((cp = fgetln(stream, &len)) != NULL) {          while ((cp = fgetln(stream, &len)) != NULL) {
                 ep = cp + len;                  ep = cp + len;
Line 250  manconf_file(struct manconf *conf, const char *file)
Line 251  manconf_file(struct manconf *conf, const char *file)
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case 0:  /* manpath */                  case 0:  /* manpath */
                         manpath_add(&conf->manpath, cp, 0);                          manpath_add(&conf->manpath, cp, 0);
                           *manpath_default = '\0';
                         break;                          break;
                 case 1:  /* output */                  case 1:  /* output */
                         manconf_output(&conf->output, cp);                          manconf_output(&conf->output, cp);
Line 258  manconf_file(struct manconf *conf, const char *file)
Line 260  manconf_file(struct manconf *conf, const char *file)
                         break;                          break;
                 }                  }
         }          }
   
         fclose(stream);          fclose(stream);
   
   out:
           if (*manpath_default != '\0')
                   manpath_parseline(&conf->manpath, manpath_default, 0);
 }  }
   #endif
   
 void  void
 manconf_output(struct manoutput *conf, const char *cp)  manconf_output(struct manoutput *conf, const char *cp)

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.26

CVSweb