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

Diff for /mandoc/man_validate.c between version 1.85 and 1.89

version 1.85, 2012/11/17 00:26:33 version 1.89, 2014/03/23 11:25:26
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010, 2012 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 32 
Line 32 
   
 #include "man.h"  #include "man.h"
 #include "mandoc.h"  #include "mandoc.h"
   #include "mandoc_aux.h"
 #include "libman.h"  #include "libman.h"
 #include "libmandoc.h"  #include "libmandoc.h"
   
Line 49  static int   check_eq2(CHKARGS);
Line 50  static int   check_eq2(CHKARGS);
 static  int       check_le1(CHKARGS);  static  int       check_le1(CHKARGS);
 static  int       check_ge2(CHKARGS);  static  int       check_ge2(CHKARGS);
 static  int       check_le5(CHKARGS);  static  int       check_le5(CHKARGS);
   static  int       check_head1(CHKARGS);
 static  int       check_par(CHKARGS);  static  int       check_par(CHKARGS);
 static  int       check_part(CHKARGS);  static  int       check_part(CHKARGS);
 static  int       check_root(CHKARGS);  static  int       check_root(CHKARGS);
Line 80  static v_check   posts_sec[] = { post_sec, NULL };
Line 82  static v_check   posts_sec[] = { post_sec, NULL };
 static  v_check   posts_sp[] = { post_vs, check_le1, NULL };  static  v_check   posts_sp[] = { post_vs, check_le1, NULL };
 static  v_check   posts_th[] = { check_ge2, check_le5, post_TH, NULL };  static  v_check   posts_th[] = { check_ge2, check_le5, post_TH, NULL };
 static  v_check   posts_uc[] = { post_UC, NULL };  static  v_check   posts_uc[] = { post_UC, NULL };
   static  v_check   posts_ur[] = { check_head1, check_part, NULL };
 static  v_check   pres_sec[] = { pre_sec, NULL };  static  v_check   pres_sec[] = { pre_sec, NULL };
   
 static  const struct man_valid man_valids[MAN_MAX] = {  static  const struct man_valid man_valids[MAN_MAX] = {
Line 119  static const struct man_valid man_valids[MAN_MAX] = {
Line 122  static const struct man_valid man_valids[MAN_MAX] = {
         { NULL, posts_eq2 }, /* OP */          { NULL, posts_eq2 }, /* OP */
         { NULL, posts_nf }, /* EX */          { NULL, posts_nf }, /* EX */
         { NULL, posts_fi }, /* EE */          { NULL, posts_fi }, /* EE */
           { NULL, posts_ur }, /* UR */
           { NULL, NULL }, /* UE */
 };  };
   
   
Line 207  check_root(CHKARGS) 
Line 212  check_root(CHKARGS) 
   
                 man->meta.title = mandoc_strdup("unknown");                  man->meta.title = mandoc_strdup("unknown");
                 man->meta.msec = mandoc_strdup("1");                  man->meta.msec = mandoc_strdup("1");
                 man->meta.date = mandoc_normdate                  man->meta.date = man->quick ? mandoc_strdup("") :
                         (man->parse, NULL, n->line, n->pos);                      mandoc_normdate(man->parse, NULL, n->line, n->pos);
         }          }
   
         return(1);          return(1);
Line 246  INEQ_DEFINE(2, >=, ge2)
Line 251  INEQ_DEFINE(2, >=, ge2)
 INEQ_DEFINE(5, <=, le5)  INEQ_DEFINE(5, <=, le5)
   
 static int  static int
   check_head1(CHKARGS)
   {
   
           if (MAN_HEAD == n->type && 1 != n->nchild)
                   mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line,
                       n->pos, "line arguments eq 1 (have %d)", n->nchild);
   
           return(1);
   }
   
   static int
 post_ft(CHKARGS)  post_ft(CHKARGS)
 {  {
         char    *cp;          char    *cp;
Line 380  static int
Line 396  static int
 post_TH(CHKARGS)  post_TH(CHKARGS)
 {  {
         const char      *p;          const char      *p;
         int              line, pos;  
   
         free(man->meta.title);          free(man->meta.title);
         free(man->meta.vol);          free(man->meta.vol);
Line 388  post_TH(CHKARGS)
Line 403  post_TH(CHKARGS)
         free(man->meta.msec);          free(man->meta.msec);
         free(man->meta.date);          free(man->meta.date);
   
         line = n->line;  
         pos = n->pos;  
         man->meta.title = man->meta.vol = man->meta.date =          man->meta.title = man->meta.vol = man->meta.date =
                 man->meta.msec = man->meta.source = NULL;                  man->meta.msec = man->meta.source = NULL;
   
Line 423  post_TH(CHKARGS)
Line 436  post_TH(CHKARGS)
         if (n)          if (n)
                 n = n->next;                  n = n->next;
         if (n && n->string && '\0' != n->string[0]) {          if (n && n->string && '\0' != n->string[0]) {
                 pos = n->pos;                  man->meta.date = man->quick ?
                 man->meta.date = mandoc_normdate                      mandoc_strdup(n->string) :
                     (man->parse, n->string, line, pos);                      mandoc_normdate(man->parse, n->string,
                           n->line, n->pos);
         } else          } else
                 man->meta.date = mandoc_strdup("");                  man->meta.date = mandoc_strdup("");
   

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.89

CVSweb