[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.261 and 1.266

version 1.261, 2014/11/28 18:09:01 version 1.266, 2015/02/03 00:48:47
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>   * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 210  static const struct valids mdoc_valids[MDOC_MAX] = {
Line 210  static const struct valids mdoc_valids[MDOC_MAX] = {
         { NULL, NULL },                         /* Nx */          { NULL, NULL },                         /* Nx */
         { NULL, NULL },                         /* Ox */          { NULL, NULL },                         /* Ox */
         { NULL, NULL },                         /* Pc */          { NULL, NULL },                         /* Pc */
         { NULL, ewarn_eq1 },                    /* Pf */          { NULL, NULL },                         /* Pf */
         { NULL, NULL },                         /* Po */          { NULL, NULL },                         /* Po */
         { NULL, NULL },                         /* Pq */          { NULL, NULL },                         /* Pq */
         { NULL, NULL },                         /* Qc */          { NULL, NULL },                         /* Qc */
Line 1047  post_vt(POST_ARGS)
Line 1047  post_vt(POST_ARGS)
 static void  static void
 post_nm(POST_ARGS)  post_nm(POST_ARGS)
 {  {
           struct mdoc_node        *n;
   
           n = mdoc->last;
   
           if (n->last != NULL &&
               (n->last->tok == MDOC_Pp ||
                n->last->tok == MDOC_Lp))
                   mdoc_node_relink(mdoc, n->last);
   
         if (NULL != mdoc->meta.name)          if (NULL != mdoc->meta.name)
                 return;                  return;
   
         mdoc_deroff(&mdoc->meta.name, mdoc->last);          mdoc_deroff(&mdoc->meta.name, n);
   
         if (NULL == mdoc->meta.name)          if (NULL == mdoc->meta.name)
                 mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse,                  mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse,
                     mdoc->last->line, mdoc->last->pos, "Nm");                      n->line, n->pos, "Nm");
 }  }
   
 static void  static void
Line 1197  post_it(POST_ARGS)
Line 1205  post_it(POST_ARGS)
         struct mdoc_node *nbl, *nit, *nch;          struct mdoc_node *nbl, *nit, *nch;
   
         nit = mdoc->last;          nit = mdoc->last;
         if (MDOC_BLOCK != nit->type)          if (nit->type != MDOC_BLOCK)
                 return;                  return;
   
         nbl = nit->parent->parent;          nbl = nit->parent->parent;
Line 1213  post_it(POST_ARGS)
Line 1221  post_it(POST_ARGS)
         case LIST_inset:          case LIST_inset:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case LIST_diag:          case LIST_diag:
                 if (NULL == nit->head->child)                  if (nit->head->child == NULL)
                         mandoc_vmsg(MANDOCERR_IT_NOHEAD,                          mandoc_vmsg(MANDOCERR_IT_NOHEAD,
                             mdoc->parse, nit->line, nit->pos,                              mdoc->parse, nit->line, nit->pos,
                             "Bl -%s It",                              "Bl -%s It",
Line 1226  post_it(POST_ARGS)
Line 1234  post_it(POST_ARGS)
         case LIST_enum:          case LIST_enum:
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case LIST_hyphen:          case LIST_hyphen:
                 if (NULL == nit->body->child)                  if (nit->body == NULL || nit->body->child == NULL)
                         mandoc_vmsg(MANDOCERR_IT_NOBODY,                          mandoc_vmsg(MANDOCERR_IT_NOBODY,
                             mdoc->parse, nit->line, nit->pos,                              mdoc->parse, nit->line, nit->pos,
                             "Bl -%s It",                              "Bl -%s It",
                             mdoc_argnames[nbl->args->argv[0].arg]);                              mdoc_argnames[nbl->args->argv[0].arg]);
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case LIST_item:          case LIST_item:
                 if (NULL != nit->head->child)                  if (nit->head->child != NULL)
                         mandoc_vmsg(MANDOCERR_ARG_SKIP,                          mandoc_vmsg(MANDOCERR_ARG_SKIP,
                             mdoc->parse, nit->line, nit->pos,                              mdoc->parse, nit->line, nit->pos,
                             "It %s", nit->head->child->string);                              "It %s", nit->head->child->string);
Line 1241  post_it(POST_ARGS)
Line 1249  post_it(POST_ARGS)
         case LIST_column:          case LIST_column:
                 cols = (int)nbl->norm->Bl.ncols;                  cols = (int)nbl->norm->Bl.ncols;
   
                 assert(NULL == nit->head->child);                  assert(nit->head->child == NULL);
   
                 for (i = 0, nch = nit->child; nch; nch = nch->next)                  for (i = 0, nch = nit->child; nch; nch = nch->next)
                         if (MDOC_BODY == nch->type)                          if (nch->type == MDOC_BODY)
                                 i++;                                  i++;
   
                 if (i < cols || i > cols + 1)                  if (i < cols || i > cols + 1)
Line 1484  post_bl(POST_ARGS)
Line 1492  post_bl(POST_ARGS)
   
         nchild = nbody->child;          nchild = nbody->child;
         while (NULL != nchild) {          while (NULL != nchild) {
                 if (MDOC_It == nchild->tok || MDOC_Sm == nchild->tok) {                  if (nchild->tok == MDOC_It ||
                       (nchild->tok == MDOC_Sm &&
                        nchild->next != NULL &&
                        nchild->next->tok == MDOC_It)) {
                         nchild = nchild->next;                          nchild = nchild->next;
                         continue;                          continue;
                 }                  }
Line 2280  post_dt(POST_ARGS)
Line 2291  post_dt(POST_ARGS)
                 mdoc->meta.msec = mandoc_strdup(nn->string);                  mdoc->meta.msec = mandoc_strdup(nn->string);
         }          }
   
         if (NULL == (nn = nn->next))          /* Handle an optional architecture */
                 goto out;  
   
         /*          if ((nn = nn->next) != NULL) {
          * If the third argument is a volume name, format is,  
          * otherwise assume it's an architecture.  
          */  
   
         cp = mdoc_a2vol(nn->string);  
         if (cp) {  
                 free(mdoc->meta.vol);  
                 mdoc->meta.vol = mandoc_strdup(cp);  
         } else {  
                 for (p = nn->string; *p; p++)                  for (p = nn->string; *p; p++)
                         *p = tolower((unsigned char)*p);                          *p = tolower((unsigned char)*p);
                 mdoc->meta.arch = mandoc_strdup(nn->string);                  mdoc->meta.arch = mandoc_strdup(nn->string);

Legend:
Removed from v.1.261  
changed lines
  Added in v.1.266

CVSweb