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

Diff for /mandoc/mdoc_validate.c between version 1.281 and 1.282

version 1.281, 2015/02/17 20:37:17 version 1.282, 2015/02/23 13:31:04
Line 1748  static void
Line 1748  static void
 post_sh_name(POST_ARGS)  post_sh_name(POST_ARGS)
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
           int hasnm, hasnd;
   
         /*          hasnm = hasnd = 0;
          * Warn if the NAME section doesn't contain the `Nm' and `Nd'  
          * macros (can have multiple `Nm' and one `Nd').  Note that the  
          * children of the BODY declaration can also be "text".  
          */  
   
         if (NULL == (n = mdoc->last->child)) {          for (n = mdoc->last->child; n != NULL; n = n->next) {
                 mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,                  switch (n->tok) {
                     mdoc->last->line, mdoc->last->pos, "empty");                  case MDOC_Nm:
                 return;                          hasnm = 1;
                           break;
                   case MDOC_Nd:
                           hasnd = 1;
                           if (n->next != NULL)
                                   mandoc_msg(MANDOCERR_NAMESEC_ND,
                                       mdoc->parse, n->line, n->pos, NULL);
                           break;
                   default:
                           mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,
                               n->line, n->pos, mdoc_macronames[n->tok]);
                           break;
                   }
         }          }
   
         for ( ; n && n->next; n = n->next) {          if ( ! hasnm)
                 if (MDOC_ELEM == n->type && MDOC_Nm == n->tok)                  mandoc_msg(MANDOCERR_NAMESEC_NONM, mdoc->parse,
                         continue;                      mdoc->last->line, mdoc->last->pos, NULL);
                 if (MDOC_TEXT == n->type)          if ( ! hasnd)
                         continue;                  mandoc_msg(MANDOCERR_NAMESEC_NOND, mdoc->parse,
                 mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,                      mdoc->last->line, mdoc->last->pos, NULL);
                     n->line, n->pos, mdoc_macronames[n->tok]);  
         }  
   
         assert(n);  
         if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok)  
                 return;  
   
         mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,  
             n->line, n->pos, mdoc_macronames[n->tok]);  
 }  }
   
 static void  static void

Legend:
Removed from v.1.281  
changed lines
  Added in v.1.282

CVSweb