[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.112 and 1.113

version 1.112, 2015/02/06 09:38:43 version 1.113, 2015/02/06 11:54:36
Line 1 
Line 1 
 /*      $OpenBSD$ */  /*      $OpenBSD$ */
 /*  /*
  * 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, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010, 2012-2015 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 38 
Line 38 
   
 typedef void    (*v_check)(CHKARGS);  typedef void    (*v_check)(CHKARGS);
   
 static  void      check_eq2(CHKARGS);  
 static  void      check_le5(CHKARGS);  
 static  void      check_par(CHKARGS);  static  void      check_par(CHKARGS);
 static  void      check_part(CHKARGS);  static  void      check_part(CHKARGS);
 static  void      check_root(CHKARGS);  static  void      check_root(CHKARGS);
Line 51  static void   post_vs(CHKARGS);
Line 49  static void   post_vs(CHKARGS);
 static  void      post_fi(CHKARGS);  static  void      post_fi(CHKARGS);
 static  void      post_ft(CHKARGS);  static  void      post_ft(CHKARGS);
 static  void      post_nf(CHKARGS);  static  void      post_nf(CHKARGS);
   static  void      post_OP(CHKARGS);
 static  void      post_TH(CHKARGS);  static  void      post_TH(CHKARGS);
 static  void      post_UC(CHKARGS);  static  void      post_UC(CHKARGS);
 static  void      post_UR(CHKARGS);  static  void      post_UR(CHKARGS);
Line 88  static v_check man_valids[MAN_MAX] = {
Line 87  static v_check man_valids[MAN_MAX] = {
         post_AT,    /* AT */          post_AT,    /* AT */
         NULL,       /* in */          NULL,       /* in */
         post_ft,    /* ft */          post_ft,    /* ft */
         check_eq2,  /* OP */          post_OP,    /* OP */
         post_nf,    /* EX */          post_nf,    /* EX */
         post_fi,    /* EE */          post_fi,    /* EE */
         post_UR,    /* UR */          post_UR,    /* UR */
Line 169  check_text(CHKARGS)
Line 168  check_text(CHKARGS)
                     n->line, n->pos + (p - cp), NULL);                      n->line, n->pos + (p - cp), NULL);
 }  }
   
 #define INEQ_DEFINE(x, ineq, name) \  static void
 static void \  post_OP(CHKARGS)
 check_##name(CHKARGS) \  {
 { \  
         if (n->nchild ineq (x)) \          if (n->nchild == 0)
                 return; \                  mandoc_msg(MANDOCERR_OP_EMPTY, man->parse,
         mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line, n->pos, \                      n->line, n->pos, "OP");
             "line arguments %s %d (have %d)", \          else if (n->nchild > 2) {
             #ineq, (x), n->nchild); \                  n = n->child->next->next;
                   mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
                       n->line, n->pos, "OP ... %s", n->string);
           }
 }  }
   
 INEQ_DEFINE(2, ==, eq2)  
 INEQ_DEFINE(5, <=, le5)  
   
 static void  static void
 post_UR(CHKARGS)  post_UR(CHKARGS)
 {  {
   
         if (MAN_HEAD == n->type && 1 != n->nchild)          if (n->type == MAN_HEAD && n->child == NULL)
                 mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line,                  mandoc_vmsg(MANDOCERR_UR_NOHEAD, man->parse,
                     n->pos, "line arguments eq 1 (have %d)", n->nchild);                      n->line, n->pos, "UR");
         check_part(man, n);          check_part(man, n);
 }  }
   
Line 303  post_TH(CHKARGS)
Line 302  post_TH(CHKARGS)
         struct man_node *nb;          struct man_node *nb;
         const char      *p;          const char      *p;
   
         check_le5(man, n);  
   
         free(man->meta.title);          free(man->meta.title);
         free(man->meta.vol);          free(man->meta.vol);
         free(man->meta.source);          free(man->meta.source);
Line 381  post_TH(CHKARGS)
Line 378  post_TH(CHKARGS)
         else if ('\0' != man->meta.msec[0] &&          else if ('\0' != man->meta.msec[0] &&
             (NULL != (p = mandoc_a2msec(man->meta.msec))))              (NULL != (p = mandoc_a2msec(man->meta.msec))))
                 man->meta.vol = mandoc_strdup(p);                  man->meta.vol = mandoc_strdup(p);
   
           if (n != NULL && (n = n->next) != NULL)
                   mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
                       n->line, n->pos, "TH ... %s", n->string);
   
         /*          /*
          * Remove the `TH' node after we've processed it for our           * Remove the `TH' node after we've processed it for our

Legend:
Removed from v.1.112  
changed lines
  Added in v.1.113

CVSweb