[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.211 and 1.213

version 1.211, 2014/04/20 19:40:13 version 1.213, 2014/04/23 16:08:33
Line 1044  post_bf(POST_ARGS)
Line 1044  post_bf(POST_ARGS)
 static int  static int
 post_lb(POST_ARGS)  post_lb(POST_ARGS)
 {  {
         const char      *p;          struct mdoc_node        *n;
         char            *buf;          const char              *stdlibname;
         size_t           sz;          char                    *libname;
   
         check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);          check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);
   
         assert(mdoc->last->child);          n = mdoc->last->child;
         assert(MDOC_TEXT == mdoc->last->child->type);  
   
         p = mdoc_a2lib(mdoc->last->child->string);          assert(n);
           assert(MDOC_TEXT == n->type);
   
         /* If lookup ok, replace with table value. */          if (NULL == (stdlibname = mdoc_a2lib(n->string)))
                   mandoc_asprintf(&libname,
                       "library \\(lq%s\\(rq", n->string);
           else
                   libname = mandoc_strdup(stdlibname);
   
         if (p) {          free(n->string);
                 free(mdoc->last->child->string);          n->string = libname;
                 mdoc->last->child->string = mandoc_strdup(p);  
                 return(1);  
         }  
   
         /* If not, use "library ``xxxx''. */  
   
         sz = strlen(mdoc->last->child->string) + 2 +  
              strlen("\\(lqlibrary\\(rq");  
         buf = mandoc_malloc(sz);  
         snprintf(buf, sz, "library \\(lq%s\\(rq",  
             mdoc->last->child->string);  
         free(mdoc->last->child->string);  
         mdoc->last->child->string = buf;  
         return(1);          return(1);
 }  }
   
Line 1192  post_defaults(POST_ARGS)
Line 1183  post_defaults(POST_ARGS)
 static int  static int
 post_at(POST_ARGS)  post_at(POST_ARGS)
 {  {
         const char       *p, *q;          struct mdoc_node        *n;
         char             *buf;          const char              *std_att;
         size_t            sz;          char                    *att;
   
         /*          /*
          * If we have a child, look it up in the standard keys.  If a           * If we have a child, look it up in the standard keys.  If a
Line 1202  post_at(POST_ARGS)
Line 1193  post_at(POST_ARGS)
          * prefix "AT&T UNIX " to the existing data.           * prefix "AT&T UNIX " to the existing data.
          */           */
   
         if (NULL == mdoc->last->child)          if (NULL == (n = mdoc->last->child))
                 return(1);                  return(1);
   
         assert(MDOC_TEXT == mdoc->last->child->type);          assert(MDOC_TEXT == n->type);
         p = mdoc_a2att(mdoc->last->child->string);          if (NULL == (std_att = mdoc_a2att(n->string))) {
   
         if (p) {  
                 free(mdoc->last->child->string);  
                 mdoc->last->child->string = mandoc_strdup(p);  
         } else {  
                 mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADATT);                  mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADATT);
                 p = "AT&T UNIX ";                  mandoc_asprintf(&att, "AT&T UNIX %s", n->string);
                 q = mdoc->last->child->string;          } else
                 sz = strlen(p) + strlen(q) + 1;                  att = mandoc_strdup(std_att);
                 buf = mandoc_malloc(sz);  
                 strlcpy(buf, p, sz);  
                 strlcat(buf, q, sz);  
                 free(mdoc->last->child->string);  
                 mdoc->last->child->string = buf;  
         }  
   
           free(n->string);
           n->string = att;
         return(1);          return(1);
 }  }
   

Legend:
Removed from v.1.211  
changed lines
  Added in v.1.213

CVSweb