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

Diff for /src/usr.bin/mandoc/Attic/mdoc_action.c between version 1.11 and 1.12

version 1.11, 2009/07/12 20:30:27 version 1.12, 2009/07/12 21:08:29
Line 237 
Line 237 
         for ( ; n; n = n->next) {          for ( ; n; n = n->next) {
                 assert(MDOC_TEXT == n->type);                  assert(MDOC_TEXT == n->type);
                 if (strlcat(buf, n->string, sz) >= sz)                  if (strlcat(buf, n->string, sz) >= sz)
                         return(nerr(m, n, ETOOLONG));                          return(mdoc_nerr(m, n, ETOOLONG));
                 if (NULL == n->next)                  if (NULL == n->next)
                         continue;                          continue;
                 if (strlcat(buf, " ", sz) >= sz)                  if (strlcat(buf, " ", sz) >= sz)
                         return(nerr(m, n, ETOOLONG));                          return(mdoc_nerr(m, n, ETOOLONG));
         }          }
   
         return(1);          return(1);
Line 316 
Line 316 
   
         m->last->args->argv[0].value = calloc(1, sizeof(char *));          m->last->args->argv[0].value = calloc(1, sizeof(char *));
         if (NULL == m->last->args->argv[0].value)          if (NULL == m->last->args->argv[0].value)
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         m->last->args->argv[0].sz = 1;          m->last->args->argv[0].sz = 1;
         m->last->args->argv[0].value[0] = strdup(m->meta.name);          m->last->args->argv[0].value[0] = strdup(m->meta.name);
         if (NULL == m->last->args->argv[0].value[0])          if (NULL == m->last->args->argv[0].value[0])
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         return(1);          return(1);
 }  }
Line 340 
Line 340 
                 return(0);                  return(0);
   
         if (NULL == (m->meta.name = strdup(buf)))          if (NULL == (m->meta.name = strdup(buf)))
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         return(1);          return(1);
 }  }
Line 413 
Line 413 
   
         if (NULL == (n = m->last->child)) {          if (NULL == (n = m->last->child)) {
                 if (NULL == (m->meta.title = strdup("unknown")))                  if (NULL == (m->meta.title = strdup("unknown")))
                         return(verr(m, EMALLOC));                          return(mdoc_nerr(m, m->last, EMALLOC));
                 if (NULL == (m->meta.vol = strdup("local")))                  if (NULL == (m->meta.vol = strdup("local")))
                         return(verr(m, EMALLOC));                          return(mdoc_nerr(m, m->last, EMALLOC));
                 return(post_prol(m));                  return(post_prol(m));
         }          }
   
Line 424 
Line 424 
          */           */
   
         if (NULL == (m->meta.title = strdup(n->string)))          if (NULL == (m->meta.title = strdup(n->string)))
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         if (NULL == (n = n->next)) {          if (NULL == (n = n->next)) {
                 if (NULL == (m->meta.vol = strdup("local")))                  if (NULL == (m->meta.vol = strdup("local")))
                         return(verr(m, EMALLOC));                          return(mdoc_nerr(m, m->last, EMALLOC));
                 return(post_prol(m));                  return(post_prol(m));
         }          }
   
Line 442 
Line 442 
         cp = mdoc_a2msec(n->string);          cp = mdoc_a2msec(n->string);
         if (cp) {          if (cp) {
                 if (NULL == (m->meta.vol = strdup(cp)))                  if (NULL == (m->meta.vol = strdup(cp)))
                         return(verr(m, EMALLOC));                          return(mdoc_nerr(m, m->last, EMALLOC));
                 errno = 0;                  errno = 0;
                 lval = strtol(n->string, &ep, 10);                  lval = strtol(n->string, &ep, 10);
                 if (n->string[0] != '\0' && *ep == '\0')                  if (n->string[0] != '\0' && *ep == '\0')
                         m->meta.msec = (int)lval;                          m->meta.msec = (int)lval;
         } else if (NULL == (m->meta.vol = strdup(n->string)))          } else if (NULL == (m->meta.vol = strdup(n->string)))
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         if (NULL == (n = n->next))          if (NULL == (n = n->next))
                 return(post_prol(m));                  return(post_prol(m));
Line 464 
Line 464 
         if (cp) {          if (cp) {
                 free(m->meta.vol);                  free(m->meta.vol);
                 if (NULL == (m->meta.vol = strdup(cp)))                  if (NULL == (m->meta.vol = strdup(cp)))
                         return(verr(m, EMALLOC));                          return(mdoc_nerr(m, m->last, EMALLOC));
                 n = n->next;                  n = n->next;
         } else {          } else {
                 cp = mdoc_a2arch(n->string);                  cp = mdoc_a2arch(n->string);
                 if (NULL == cp) {                  if (NULL == cp) {
                         free(m->meta.vol);                          free(m->meta.vol);
                         if (NULL == (m->meta.vol = strdup(n->string)))                          if (NULL == (m->meta.vol = strdup(n->string)))
                                 return(verr(m, EMALLOC));                                  return(mdoc_nerr(m, m->last, EMALLOC));
                 } else if (NULL == (m->meta.arch = strdup(cp)))                  } else if (NULL == (m->meta.arch = strdup(cp)))
                         return(verr(m, EMALLOC));                          return(mdoc_nerr(m, m->last, EMALLOC));
         }          }
   
         /* Ignore any subsequent parameters... */          /* Ignore any subsequent parameters... */
Line 497 
Line 497 
   
         if (0 == buf[0]) {          if (0 == buf[0]) {
                 if (-1 == uname(&utsname))                  if (-1 == uname(&utsname))
                         return(verr(m, EUTSNAME));                          return(mdoc_nerr(m, m->last, EUTSNAME));
                 if (strlcat(buf, utsname.sysname, 64) >= 64)                  if (strlcat(buf, utsname.sysname, 64) >= 64)
                         return(verr(m, ETOOLONG));                          return(mdoc_nerr(m, m->last, ETOOLONG));
                 if (strlcat(buf, " ", 64) >= 64)                  if (strlcat(buf, " ", 64) >= 64)
                         return(verr(m, ETOOLONG));                          return(mdoc_nerr(m, m->last, ETOOLONG));
                 if (strlcat(buf, utsname.release, 64) >= 64)                  if (strlcat(buf, utsname.release, 64) >= 64)
                         return(verr(m, ETOOLONG));                          return(mdoc_nerr(m, m->last, ETOOLONG));
         }          }
   
         if (NULL == (m->meta.os = strdup(buf)))          if (NULL == (m->meta.os = strdup(buf)))
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         m->flags |= MDOC_PBODY;          m->flags |= MDOC_PBODY;
         return(post_prol(m));          return(post_prol(m));
Line 549 
Line 549 
         }          }
   
         if (-1 == snprintf(buf, sizeof(buf), "%dn", sz))          if (-1 == snprintf(buf, sizeof(buf), "%dn", sz))
                 return(verr(m, ENUMFMT));                  return(mdoc_nerr(m, m->last, ENUMFMT));
   
         /*          /*
          * We have to dynamically add this to the macro's argument list.           * We have to dynamically add this to the macro's argument list.
Line 564 
Line 564 
                         n->args->argc * sizeof(struct mdoc_argv));                          n->args->argc * sizeof(struct mdoc_argv));
   
         if (NULL == n->args->argv)          if (NULL == n->args->argv)
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         n->args->argv[sz].arg = MDOC_Width;          n->args->argv[sz].arg = MDOC_Width;
         n->args->argv[sz].line = m->last->line;          n->args->argv[sz].line = m->last->line;
Line 573 
Line 573 
         n->args->argv[sz].value = calloc(1, sizeof(char *));          n->args->argv[sz].value = calloc(1, sizeof(char *));
   
         if (NULL == n->args->argv[sz].value)          if (NULL == n->args->argv[sz].value)
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
         if (NULL == (n->args->argv[sz].value[0] = strdup(buf)))          if (NULL == (n->args->argv[sz].value[0] = strdup(buf)))
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         return(1);          return(1);
 }  }
Line 615 
Line 615 
         /* The value already exists: free and reallocate it. */          /* The value already exists: free and reallocate it. */
   
         if (-1 == snprintf(buf, sizeof(buf), "%zun", width))          if (-1 == snprintf(buf, sizeof(buf), "%zun", width))
                 return(verr(m, ENUMFMT));                  return(mdoc_nerr(m, m->last, ENUMFMT));
   
         free(m->last->args->argv[i].value[0]);          free(m->last->args->argv[i].value[0]);
         m->last->args->argv[i].value[0] = strdup(buf);          m->last->args->argv[i].value[0] = strdup(buf);
         if (NULL == m->last->args->argv[i].value[0])          if (NULL == m->last->args->argv[i].value[0])
                 return(verr(m, EMALLOC));                  return(mdoc_nerr(m, m->last, EMALLOC));
   
         return(1);          return(1);
 }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12