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

Diff for /mandoc/main.c between version 1.293 and 1.294

version 1.293, 2017/06/24 14:38:32 version 1.294, 2017/07/01 09:47:30
Line 43 
Line 43 
   
 #include "mandoc_aux.h"  #include "mandoc_aux.h"
 #include "mandoc.h"  #include "mandoc.h"
   #include "mandoc_xr.h"
 #include "roff.h"  #include "roff.h"
 #include "mdoc.h"  #include "mdoc.h"
 #include "man.h"  #include "man.h"
Line 86  struct curparse {
Line 87  struct curparse {
   
 int                       mandocdb(int, char *[]);  int                       mandocdb(int, char *[]);
   
   static  void              check_xr(const char *);
 static  int               fs_lookup(const struct manpaths *,  static  int               fs_lookup(const struct manpaths *,
                                 size_t ipath, const char *,                                  size_t ipath, const char *,
                                 const char *, const char *,                                  const char *, const char *,
Line 517  main(int argc, char *argv[])
Line 519  main(int argc, char *argv[])
                         break;                          break;
                 }                  }
         }          }
           mandoc_xr_free();
         mparse_free(curp.mp);          mparse_free(curp.mp);
         mchars_free();          mchars_free();
   
Line 747  parse(struct curparse *curp, int fd, const char *file)
Line 750  parse(struct curparse *curp, int fd, const char *file)
   
         if (man == NULL)          if (man == NULL)
                 return;                  return;
           if (curp->mmin < MANDOCERR_STYLE)
                   mandoc_xr_reset();
         if (man->macroset == MACROSET_MDOC) {          if (man->macroset == MACROSET_MDOC) {
                 if (curp->outtype != OUTT_TREE || !curp->outopts->noval)                  if (curp->outtype != OUTT_TREE || !curp->outopts->noval)
                         mdoc_validate(man);                          mdoc_validate(man);
Line 798  parse(struct curparse *curp, int fd, const char *file)
Line 803  parse(struct curparse *curp, int fd, const char *file)
                         break;                          break;
                 }                  }
         }          }
           check_xr(file);
         mparse_updaterc(curp->mp, &rc);          mparse_updaterc(curp->mp, &rc);
   }
   
   static void
   check_xr(const char *file)
   {
           static struct manpaths   paths;
           struct mansearch         search;
           struct mandoc_xr        *xr;
           char                    *cp;
           size_t                   sz;
   
           if (paths.sz == 0)
                   manpath_base(&paths);
   
           for (xr = mandoc_xr_get(); xr != NULL; xr = xr->next) {
                   search.arch = NULL;
                   search.sec = xr->sec;
                   search.outkey = NULL;
                   search.argmode = ARG_NAME;
                   search.firstmatch = 1;
                   if (mansearch(&search, &paths, 1, &xr->name, NULL, &sz))
                           continue;
                   mandoc_asprintf(&cp, "Xr %s %s", xr->name, xr->sec);
                   mmsg(MANDOCERR_XR_BAD, MANDOCLEVEL_STYLE,
                       file, xr->line, xr->pos + 1, cp);
                   free(cp);
           }
 }  }
   
 static void  static void

Legend:
Removed from v.1.293  
changed lines
  Added in v.1.294

CVSweb