[BACK]Return to mdoc_validate.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/mdoc_validate.c between version 1.54 and 1.55

version 1.54, 2010/05/15 18:25:51 version 1.55, 2010/05/23 22:45:01
Line 22 
Line 22 
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   
   #include "mandoc.h"
 #include "libmdoc.h"  #include "libmdoc.h"
 #include "libmandoc.h"  #include "libmandoc.h"
   
Line 317 
Line 318 
                 int want, const char *v, int has)                  int want, const char *v, int has)
 {  {
   
         return(mdoc_vwarn(m, m->last->line, m->last->pos,          return(mdoc_vmsg(m, MANDOCERR_ARGCOUNT,
                 "suggests %s %s %d (has %d)", v, k, want, has));                                  m->last->line, m->last->pos,
                                   "%s %s %d (have %d)", v, k, want, has));
 }  }
   
   
Line 327 
Line 329 
                 int want, const char *v, int has)                  int want, const char *v, int has)
 {  {
   
         return(mdoc_verr(m, m->last->line, m->last->pos,          mdoc_vmsg(m, MANDOCERR_SYNTARGCOUNT,
                 "requires %s %s %d (has %d)", v, k, want, has));                          m->last->line, m->last->pos,
                           "%s %s %d (have %d)",
                           v, k, want, has);
           return(0);
 }  }
   
   
Line 401 
Line 406 
         if (n->args && 1 == n->args->argc)          if (n->args && 1 == n->args->argc)
                 if (MDOC_Std == n->args->argv[0].arg)                  if (MDOC_Std == n->args->argv[0].arg)
                         return(1);                          return(1);
         return(mdoc_nwarn(mdoc, n, EARGVAL));          return(mdoc_nmsg(mdoc, n, MANDOCERR_NOARGV));
 }  }
   
   
Line 433 
Line 438 
                         return(0);                          return(0);
   
         if (MDOC_Std == v->arg) {          if (MDOC_Std == v->arg) {
                 /* `Nm' name must be set. */  
                 if (v->sz || m->meta.name)                  if (v->sz || m->meta.name)
                         return(1);                          return(1);
                 return(mdoc_nerr(m, n, ENAME));                  if ( ! mdoc_nmsg(m, n, MANDOCERR_NONAME))
                           return(0);
         }          }
   
         return(1);          return(1);
Line 451 
Line 456 
         for ( ; *p; p++, pos++) {          for ( ; *p; p++, pos++) {
                 if ('\t' == *p) {                  if ('\t' == *p) {
                         if ( ! (MDOC_LITERAL & mdoc->flags))                          if ( ! (MDOC_LITERAL & mdoc->flags))
                                 if ( ! mdoc_pwarn(mdoc, line, pos, EPRINT))                                  if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR))
                                         return(0);                                          return(0);
                 } else if ( ! isprint((u_char)*p))                  } else if ( ! isprint((u_char)*p))
                         if ( ! mdoc_pwarn(mdoc, line, pos, EPRINT))                          if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR))
                                 return(0);                                  return(0);
   
                 if ('\\' != *p)                  if ('\\' != *p)
Line 466 
Line 471 
                         pos += c - 1;                          pos += c - 1;
                         continue;                          continue;
                 }                  }
                 if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags))  
                         return(mdoc_perr(mdoc, line, pos, EESCAPE));                  c = mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADESCAPE);
                 if ( ! mdoc_pwarn(mdoc, line, pos, EESCAPE))                  if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags) && ! c)
                         return(0);                          return(c);
         }          }
   
         return(1);          return(1);
Line 487 
Line 492 
                         (t == n->parent->type))                          (t == n->parent->type))
                 return(1);                  return(1);
   
         return(mdoc_verr(mdoc, n->line, n->pos, "require parent %s",          mdoc_vmsg(mdoc, MANDOCERR_SYNTCHILD,
                 MDOC_ROOT == t ? "<root>" : mdoc_macronames[tok]));                                  n->line, n->pos, "want parent %s",
                                   MDOC_ROOT == t ? "<root>" :
                                           mdoc_macronames[tok]);
           return(0);
 }  }
   
   
Line 511 
Line 519 
         if (NULL == node)          if (NULL == node)
                 return(1);                  return(1);
   
         return(mdoc_nerr(mdoc, n, ENESTDISP));          mdoc_nmsg(mdoc, n, MANDOCERR_NESTEDDISP);
           return(0);
 }  }
   
   
Line 522 
Line 531 
   
         if (MDOC_BLOCK != n->type)          if (MDOC_BLOCK != n->type)
                 return(1);                  return(1);
         if (NULL == n->args)          if (NULL == n->args) {
                 return(mdoc_nerr(mdoc, n, ELISTTYPE));                  mdoc_nmsg(mdoc, n, MANDOCERR_LISTTYPE);
                   return(0);
           }
   
         /* Make sure that only one type of list is specified.  */          /* Make sure that only one type of list is specified.  */
   
Line 563 
Line 574 
                          * FIXME: this should occur in mdoc_action.c.                           * FIXME: this should occur in mdoc_action.c.
                          */                           */
                         if (type >= 0) {                          if (type >= 0) {
                                 if ( ! mdoc_nwarn(mdoc, n, EMULTILIST))                                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTREP))
                                         return(0);                                          return(0);
                                 mdoc_argn_free(n->args, pos);                                  mdoc_argn_free(n->args, pos);
                                 break;                                  break;
Line 571 
Line 582 
                         type = n->args->argv[pos].arg;                          type = n->args->argv[pos].arg;
                         break;                          break;
                 case (MDOC_Compact):                  case (MDOC_Compact):
                         if (type < 0 && ! mdoc_nwarn(mdoc, n, ENOTYPE))                          if (type < 0 && ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
                                 return(0);                                  return(0);
                         break;                          break;
                 case (MDOC_Width):                  case (MDOC_Width):
                         if (width >= 0)                          if (width >= 0)
                                 return(mdoc_nerr(mdoc, n, EARGREP));                                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGVREP))
                         if (type < 0 && ! mdoc_nwarn(mdoc, n, ENOTYPE))                                          return(0);
                           if (type < 0 && ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
                                 return(0);                                  return(0);
                         width = n->args->argv[pos].arg;                          width = n->args->argv[pos].arg;
                         break;                          break;
                 case (MDOC_Offset):                  case (MDOC_Offset):
                         if (offset >= 0)                          if (offset >= 0)
                                 return(mdoc_nerr(mdoc, n, EARGREP));                                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGVREP))
                         if (type < 0 && ! mdoc_nwarn(mdoc, n, ENOTYPE))                                          return(0);
                           if (type < 0 && ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
                                 return(0);                                  return(0);
                         offset = n->args->argv[pos].arg;                          offset = n->args->argv[pos].arg;
                         break;                          break;
Line 592 
Line 605 
                         break;                          break;
                 }                  }
   
         if (type < 0)          if (type < 0) {
                 return(mdoc_nerr(mdoc, n, ELISTTYPE));                  mdoc_nmsg(mdoc, n, MANDOCERR_LISTTYPE);
                   return(0);
           }
   
         /*          /*
          * Validate the width field.  Some list types don't need width           * Validate the width field.  Some list types don't need width
Line 603 
Line 618 
   
         switch (type) {          switch (type) {
         case (MDOC_Tag):          case (MDOC_Tag):
                 if (width < 0 && ! mdoc_nwarn(mdoc, n, EMISSWIDTH))                  if (width < 0 && ! mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG))
                         return(0);                          return(0);
                 break;                  break;
         case (MDOC_Column):          case (MDOC_Column):
Line 615 
Line 630 
         case (MDOC_Inset):          case (MDOC_Inset):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Item):          case (MDOC_Item):
                 if (width >= 0 && ! mdoc_nwarn(mdoc, n, ENOWIDTH))                  if (width >= 0 && ! mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG))
                         return(0);                          return(0);
                 break;                  break;
         default:          default:
Line 633 
Line 648 
   
         if (MDOC_BLOCK != n->type)          if (MDOC_BLOCK != n->type)
                 return(1);                  return(1);
         if (NULL == n->args)          if (NULL == n->args) {
                 return(mdoc_nerr(mdoc, n, EDISPTYPE));                  mdoc_nmsg(mdoc, n, MANDOCERR_DISPTYPE);
                   return(0);
           }
   
         /* Make sure that only one type of display is specified.  */          /* Make sure that only one type of display is specified.  */
   
Line 653 
Line 670 
                 case (MDOC_Literal):                  case (MDOC_Literal):
                         if (0 == type++)                          if (0 == type++)
                                 break;                                  break;
                         return(mdoc_nerr(mdoc, n, EMULTIDISP));                          if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_DISPREP))
                                   return(0);
                           break;
                 default:                  default:
                         break;                          break;
                 }                  }
   
         if (type)          if (type)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, n, EDISPTYPE));          mdoc_nmsg(mdoc, n, MANDOCERR_DISPTYPE);
           return(0);
 }  }
   
   
Line 690 
Line 710 
   
         if (MDOC_BLOCK != n->type)          if (MDOC_BLOCK != n->type)
                 return(1);                  return(1);
           /*
            * FIXME: this can probably be lifted if we make the It into
            * something else on-the-fly?
            */
         return(check_parent(mdoc, n, MDOC_Bl, MDOC_BODY));          return(check_parent(mdoc, n, MDOC_Bl, MDOC_BODY));
 }  }
   
Line 700 
Line 724 
   
         if (NULL == n->args || 1 == n->args->argc)          if (NULL == n->args || 1 == n->args->argc)
                 return(1);                  return(1);
         return(mdoc_verr(mdoc, n->line, n->pos,          mdoc_vmsg(mdoc, MANDOCERR_SYNTARGCOUNT,
                                 "only one argument allowed"));                                  n->line, n->pos,
                                   "line arguments == 1 (have %d)",
                                   n->args->argc);
           return(0);
 }  }
   
   
Line 720 
Line 747 
         /* FIXME: make sure is capitalised. */          /* FIXME: make sure is capitalised. */
   
         if (0 == mdoc->meta.date || mdoc->meta.os)          if (0 == mdoc->meta.date || mdoc->meta.os)
                 if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO))
                         return(0);                          return(0);
         if (mdoc->meta.title)          if (mdoc->meta.title)
                 if ( ! mdoc_nwarn(mdoc, n, EPROLREP))                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGREP))
                         return(0);                          return(0);
         return(1);          return(1);
 }  }
Line 734 
Line 761 
 {  {
   
         if (NULL == mdoc->meta.title || 0 == mdoc->meta.date)          if (NULL == mdoc->meta.title || 0 == mdoc->meta.date)
                 if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO))
                         return(0);                          return(0);
         if (mdoc->meta.os)          if (mdoc->meta.os)
                 if ( ! mdoc_nwarn(mdoc, n, EPROLREP))                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGREP))
                         return(0);                          return(0);
         return(1);          return(1);
 }  }
Line 748 
Line 775 
 {  {
   
         if (mdoc->meta.title || mdoc->meta.os)          if (mdoc->meta.title || mdoc->meta.os)
                 if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO))
                         return(0);                          return(0);
         if (mdoc->meta.date)          if (mdoc->meta.date)
                 if ( ! mdoc_nwarn(mdoc, n, EPROLREP))                  if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGREP))
                         return(0);                          return(0);
         return(1);          return(1);
 }  }
Line 768 
Line 795 
   
         head = mdoc->last->head;          head = mdoc->last->head;
   
         if (mdoc->last->args && head->child)          if (mdoc->last->args && head->child) {
                 return(mdoc_nerr(mdoc, mdoc->last, ELINE));                  /* FIXME: this should provide a default. */
         else if (mdoc->last->args)                  mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SYNTARGVCOUNT);
                   return(0);
           } else if (mdoc->last->args)
                 return(1);                  return(1);
   
         if (NULL == head->child || MDOC_TEXT != head->child->type)          if (NULL == head->child || MDOC_TEXT != head->child->type) {
                 return(mdoc_nerr(mdoc, mdoc->last, ELINE));                  /* FIXME: this should provide a default. */
                   mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SYNTARGVCOUNT);
                   return(0);
           }
   
         p = head->child->string;          p = head->child->string;
   
Line 785 
Line 817 
         else if (0 == strcmp(p, "Sy"))          else if (0 == strcmp(p, "Sy"))
                 return(1);                  return(1);
   
         return(mdoc_nerr(mdoc, head, EFONT));          mdoc_nmsg(mdoc, head, MANDOCERR_FONTTYPE);
           return(0);
 }  }
   
   
Line 795 
Line 828 
   
         if (mdoc_a2lib(mdoc->last->child->string))          if (mdoc_a2lib(mdoc->last->child->string))
                 return(1);                  return(1);
         return(mdoc_nwarn(mdoc, mdoc->last, ELIB));          return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADLIB));
 }  }
   
   
Line 818 
Line 851 
   
         for (n = mdoc->last->child; n; n = n->next)          for (n = mdoc->last->child; n; n = n->next)
                 if (MDOC_TEXT != n->type)                  if (MDOC_TEXT != n->type)
                         if ( ! mdoc_nwarn(mdoc, n, EBADCHILD))                          if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_CHILD))
                                 return(0);                                  return(0);
   
         return(1);          return(1);
Line 833 
Line 866 
                 return(1);                  return(1);
         if (mdoc->meta.name)          if (mdoc->meta.name)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, mdoc->last, ENAME));          return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NONAME));
 }  }
   
   
Line 843 
Line 876 
   
         if (NULL == mdoc->last->child)          if (NULL == mdoc->last->child)
                 return(1);                  return(1);
         if (MDOC_TEXT != mdoc->last->child->type)          assert(MDOC_TEXT == mdoc->last->child->type);
                 return(mdoc_nerr(mdoc, mdoc->last, EATT));  
         if (mdoc_a2att(mdoc->last->child->string))          if (mdoc_a2att(mdoc->last->child->string))
                 return(1);                  return(1);
         return(mdoc_nwarn(mdoc, mdoc->last, EATT));          return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADATT));
 }  }
   
   
Line 858 
Line 890 
         if (mdoc->last->args) {          if (mdoc->last->args) {
                 if (NULL == mdoc->last->child)                  if (NULL == mdoc->last->child)
                         return(1);                          return(1);
                 return(mdoc_nerr(mdoc, mdoc->last, ENOLINE));                  return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGCOUNT));
         }          }
   
         if (mdoc->last->child)          if (mdoc->last->child)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, mdoc->last, ELINE));          return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS));
 }  }
   
   
Line 877 
Line 909 
                 return(1);                  return(1);
   
         n = mdoc->last->parent->parent;          n = mdoc->last->parent->parent;
         if (NULL == n->args)          if (NULL == n->args) {
                 return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE));                  mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_LISTTYPE);
                   return(0);
           }
   
         /* Some types require block-head, some not. */          /* Some types require block-head, some not. */
   
Line 915 
Line 949 
                         break;                          break;
                 }                  }
   
         if (-1 == type)          if (-1 == type) {
                 return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE));                  mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_LISTTYPE);
                   return(0);
           }
   
         switch (type) {          switch (type) {
         case (MDOC_Tag):          case (MDOC_Tag):
                 if (NULL == mdoc->last->head->child)                  if (NULL == mdoc->last->head->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, ELINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS))
                                 return(0);                                  return(0);
                 break;                  break;
         case (MDOC_Hang):          case (MDOC_Hang):
Line 932 
Line 968 
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Diag):          case (MDOC_Diag):
                 if (NULL == mdoc->last->head->child)                  if (NULL == mdoc->last->head->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, ELINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS))
                                 return(0);                                  return(0);
                 if (NULL == mdoc->last->body->child)                  if (NULL == mdoc->last->body->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, EMULTILINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY))
                                 return(0);                                  return(0);
                 break;                  break;
         case (MDOC_Bullet):          case (MDOC_Bullet):
Line 948 
Line 984 
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_Item):          case (MDOC_Item):
                 if (mdoc->last->head->child)                  if (mdoc->last->head->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, ENOLINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST))
                                 return(0);                                  return(0);
                 if (NULL == mdoc->last->body->child)                  if (NULL == mdoc->last->body->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, EMULTILINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY))
                                 return(0);                                  return(0);
                 break;                  break;
         case (MDOC_Column):          case (MDOC_Column):
                 if (NULL == mdoc->last->head->child)                  if (NULL == mdoc->last->head->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, ELINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS))
                                 return(0);                                  return(0);
                 if (mdoc->last->body->child)                  if (mdoc->last->body->child)
                         if ( ! mdoc_nwarn(mdoc, mdoc->last, ENOMULTILINE))                          if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BODYLOST))
                                 return(0);                                  return(0);
                 c = mdoc->last->child;                  c = mdoc->last->child;
                 for (i = 0; c && MDOC_HEAD == c->type; c = c->next)                  for (i = 0; c && MDOC_HEAD == c->type; c = c->next)
                         i++;                          i++;
   
                 if (i < cols) {                  if (i < cols) {
                         if ( ! mdoc_vwarn(mdoc, mdoc->last->line,                          if ( ! mdoc_vmsg(mdoc, MANDOCERR_ARGCOUNT,
                                         mdoc->last->pos, "column "                                          mdoc->last->line,
                                         "mismatch: have %d, want %d",                                          mdoc->last->pos,
                                         i, cols))                                          "columns == %d (have %d)",
                                           cols, i))
                                 return(0);                                  return(0);
                         break;                          break;
                 } else if (i == cols || i == cols + 1)                  } else if (i == cols || i == cols + 1)
                         break;                          break;
   
                 return(mdoc_verr(mdoc, mdoc->last->line,                  mdoc_vmsg(mdoc, MANDOCERR_SYNTARGCOUNT,
                                 mdoc->last->pos, "column mismatch: "                                  mdoc->last->line, mdoc->last->pos,
                                 "have %d, want %d", i, cols));                                  "columns == %d (have %d)", cols, i);
                   return(0);
         default:          default:
                 break;                  break;
         }          }
Line 1000 
Line 1038 
                 a = &n->args->argv[i];                  a = &n->args->argv[i];
                 if (a->arg == MDOC_Column) {                  if (a->arg == MDOC_Column) {
                         if (a->sz && mdoc->last->nchild)                          if (a->sz && mdoc->last->nchild)
                                 return(mdoc_nerr(mdoc, n, ECOLMIS));                                  return(mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS));
                         return(1);                          return(1);
                 }                  }
         }          }
Line 1035 
Line 1073 
                         continue;                          continue;
                 if (MDOC_Sm == n->tok)                  if (MDOC_Sm == n->tok)
                         continue;                          continue;
                 return(mdoc_nerr(mdoc, n, EBADCHILD));                  mdoc_nmsg(mdoc, n, MANDOCERR_SYNTCHILD);
                   return(0);
         }          }
   
         return(1);          return(1);
Line 1060 
Line 1099 
   
         if (NULL == n)          if (NULL == n)
                 return(1);                  return(1);
         return(mdoc_nerr(mdoc, n, EBOOL));          return(mdoc_nmsg(mdoc, n, MANDOCERR_BADBOOL));
 }  }
   
   
Line 1069 
Line 1108 
 {  {
   
         if (NULL == mdoc->first->child)          if (NULL == mdoc->first->child)
                 return(mdoc_nerr(mdoc, mdoc->first, ENODAT));                  mdoc_nmsg(mdoc, mdoc->first, MANDOCERR_NODOCBODY);
         if ( ! (MDOC_PBODY & mdoc->flags))          else if ( ! (MDOC_PBODY & mdoc->flags))
                 return(mdoc_nerr(mdoc, mdoc->first, ENOPROLOGUE));                  mdoc_nmsg(mdoc, mdoc->first, MANDOCERR_NODOCPROLOG);
           else if (MDOC_BLOCK != mdoc->first->child->type)
                   mdoc_nmsg(mdoc, mdoc->first, MANDOCERR_NODOCBODY);
           else if (MDOC_Sh != mdoc->first->child->tok)
                   mdoc_nmsg(mdoc, mdoc->first, MANDOCERR_NODOCBODY);
           else
                   return(1);
   
         if (MDOC_BLOCK != mdoc->first->child->type)          return(0);
                 return(mdoc_nerr(mdoc, mdoc->first, ENODAT));  
         if (MDOC_Sh != mdoc->first->child->tok)  
                 return(mdoc_nerr(mdoc, mdoc->first, ENODAT));  
   
         return(1);  
 }  }
   
   
Line 1088 
Line 1128 
   
         if (mdoc_a2st(mdoc->last->child->string))          if (mdoc_a2st(mdoc->last->child->string))
                 return(1);                  return(1);
         return(mdoc_nwarn(mdoc, mdoc->last, EBADSTAND));          return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADSTANDARD));
 }  }
   
   
Line 1131 
Line 1171 
                 case(MDOC__V):                  case(MDOC__V):
                         break;                          break;
                 default:                  default:
                         return(mdoc_nerr(mdoc, nn, EBADCHILD));                          mdoc_nmsg(mdoc, nn, MANDOCERR_SYNTCHILD);
                           return(0);
                 }                  }
   
         return(1);          return(1);
Line 1166 
Line 1207 
          */           */
   
         if (NULL == (n = mdoc->last->child))          if (NULL == (n = mdoc->last->child))
                 return(mdoc_nwarn(mdoc, mdoc->last, ENAMESECINC));                  return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADNAMESEC));
   
         for ( ; n && n->next; n = n->next) {          for ( ; n && n->next; n = n->next) {
                 if (MDOC_ELEM == n->type && MDOC_Nm == n->tok)                  if (MDOC_ELEM == n->type && MDOC_Nm == n->tok)
                         continue;                          continue;
                 if (MDOC_TEXT == n->type)                  if (MDOC_TEXT == n->type)
                         continue;                          continue;
                 if ( ! mdoc_nwarn(mdoc, mdoc->last, ENAMESECINC))                  if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADNAMESEC))
                         return(0);                          return(0);
         }          }
   
         assert(n);          assert(n);
         if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok)          if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok)
                 return(1);                  return(1);
         return(mdoc_nwarn(mdoc, mdoc->last, ENAMESECINC));          return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADNAMESEC));
 }  }
   
   
Line 1198 
Line 1239 
          * certain manual sections.           * certain manual sections.
          */           */
   
         buf[0] = 0;          buf[0] = '\0';
   
           /*
            * FIXME: yes, these can use a dynamic buffer, but I don't do so
            * in the interests of simplicity.
            */
   
         for (n = mdoc->last->child; n; n = n->next) {          for (n = mdoc->last->child; n; n = n->next) {
                 /* XXX - copied from compact(). */                  /* XXX - copied from compact(). */
                 assert(MDOC_TEXT == n->type);                  assert(MDOC_TEXT == n->type);
   
                 if (strlcat(buf, n->string, 64) >= 64)                  if (strlcat(buf, n->string, 64) >= 64) {
                         return(mdoc_nerr(mdoc, n, ETOOLONG));                          mdoc_nmsg(mdoc, n, MANDOCERR_MEM);
                           return(0);
                   }
                 if (NULL == n->next)                  if (NULL == n->next)
                         continue;                          continue;
                 if (strlcat(buf, " ", 64) >= 64)                  if (strlcat(buf, " ", 64) >= 64) {
                         return(mdoc_nerr(mdoc, n, ETOOLONG));                          mdoc_nmsg(mdoc, n, MANDOCERR_MEM);
                           return(0);
                   }
         }          }
   
         sec = mdoc_str2sec(buf);          sec = mdoc_str2sec(buf);
Line 1220 
Line 1270 
          */           */
   
         if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)          if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
                 if ( ! mdoc_nwarn(mdoc, mdoc->last, ESECNAME))                  if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NAMESECFIRST))
                         return(0);                          return(0);
   
         if (SEC_CUSTOM == sec)          if (SEC_CUSTOM == sec)
                 return(1);                  return(1);
   
         if (sec == mdoc->lastnamed)          if (sec == mdoc->lastnamed)
                 if ( ! mdoc_nwarn(mdoc, mdoc->last, ESECREP))                  if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SECREP))
                         return(0);                          return(0);
   
         if (sec < mdoc->lastnamed)          if (sec < mdoc->lastnamed)
                 if ( ! mdoc_nwarn(mdoc, mdoc->last, ESECOOO))                  if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SECOOO))
                         return(0);                          return(0);
   
         /*          /*
Line 1248 
Line 1298 
                         break;                          break;
                 if (*mdoc->meta.msec == '9')                  if (*mdoc->meta.msec == '9')
                         break;                          break;
                 return(mdoc_nwarn(mdoc, mdoc->last, EWRONGMSEC));                  return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_SECMSEC));
         default:          default:
                 break;                  break;
         }          }

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55