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

Diff for /mandoc/mdoc_term.c between version 1.97 and 1.98

version 1.97, 2009/10/27 08:26:12 version 1.98, 2009/10/27 08:49:44
Line 348  print_node(DECL_ARGS)
Line 348  print_node(DECL_ARGS)
 static void  static void
 print_foot(DECL_ARGS)  print_foot(DECL_ARGS)
 {  {
         char             buf[DATESIZ];          char            buf[DATESIZ], os[BUFSIZ];
         char            *os;  
   
         /*          /*
          * Output the footer in new-groff style, that is, three columns           * Output the footer in new-groff style, that is, three columns
Line 359  print_foot(DECL_ARGS)
Line 358  print_foot(DECL_ARGS)
          * SYSTEM                  DATE                    SYSTEM           * SYSTEM                  DATE                    SYSTEM
          */           */
   
         if (NULL == (os = malloc(p->rmargin)))  
                 err(EXIT_FAILURE, "malloc");  
   
         time2a(m->date, buf, DATESIZ);          time2a(m->date, buf, DATESIZ);
           strlcpy(os, m->os, BUFSIZ);
   
         (void)strlcpy(os, m->os, p->rmargin);  
   
         term_vspace(p);          term_vspace(p);
   
         p->offset = 0;          p->offset = 0;
Line 393  print_foot(DECL_ARGS)
Line 388  print_foot(DECL_ARGS)
         p->offset = 0;          p->offset = 0;
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
         p->flags = 0;          p->flags = 0;
   
         free(os);  
 }  }
   
   
Line 403  print_foot(DECL_ARGS)
Line 396  print_foot(DECL_ARGS)
 static void  static void
 print_head(DECL_ARGS)  print_head(DECL_ARGS)
 {  {
         char            *buf, *title;          char            buf[BUFSIZ], title[BUFSIZ];
   
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
         p->offset = 0;          p->offset = 0;
   
         if (NULL == (buf = malloc(p->rmargin)))  
                 err(EXIT_FAILURE, "malloc");  
         if (NULL == (title = malloc(p->rmargin)))  
                 err(EXIT_FAILURE, "malloc");  
   
         /*          /*
          * The header is strange.  It has three components, which are           * The header is strange.  It has three components, which are
          * really two with the first duplicated.  It goes like this:           * really two with the first duplicated.  It goes like this:
Line 427  print_head(DECL_ARGS)
Line 415  print_head(DECL_ARGS)
          */           */
   
         assert(m->vol);          assert(m->vol);
         (void)strlcpy(buf, m->vol, p->rmargin);          strlcpy(buf, m->vol, BUFSIZ);
   
         if (m->arch) {          if (m->arch) {
                 (void)strlcat(buf, " (", p->rmargin);                  strlcat(buf, " (", BUFSIZ);
                 (void)strlcat(buf, m->arch, p->rmargin);                  strlcat(buf, m->arch, BUFSIZ);
                 (void)strlcat(buf, ")", p->rmargin);                  strlcat(buf, ")", BUFSIZ);
         }          }
   
         snprintf(title, p->rmargin, "%s(%d)", m->title, m->msec);          snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec);
   
         p->offset = 0;          p->offset = 0;
         p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2;          p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2;
Line 462  print_head(DECL_ARGS)
Line 450  print_head(DECL_ARGS)
         p->offset = 0;          p->offset = 0;
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
         p->flags &= ~TERMP_NOSPACE;          p->flags &= ~TERMP_NOSPACE;
   
         free(title);  
         free(buf);  
 }  }
   
   

Legend:
Removed from v.1.97  
changed lines
  Added in v.1.98

CVSweb