[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.101

version 1.97, 2009/10/27 08:26:12 version 1.101, 2009/11/10 11:45:57
Line 18 
Line 18 
   
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
 #include <err.h>  
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 348  print_node(DECL_ARGS)
Line 347  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;  
   
           /* Disable meta-fonts. */
           p->metafont = 0;
   
         /*          /*
          * Output the footer in new-groff style, that is, three columns           * Output the footer in new-groff style, that is, three columns
          * with the middle being the manual date and flanking columns           * with the middle being the manual date and flanking columns
Line 359  print_foot(DECL_ARGS)
Line 360  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 390  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 398  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 417  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 452  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);  
 }  }
   
   
Line 1650  termp_xx_pre(DECL_ARGS)
Line 1637  termp_xx_pre(DECL_ARGS)
                 pp = "BSDI BSD/OS";                  pp = "BSDI BSD/OS";
                 break;                  break;
         case (MDOC_Dx):          case (MDOC_Dx):
                 pp = "DragonFlyBSD";                  pp = "DragonFly";
                 break;                  break;
         case (MDOC_Fx):          case (MDOC_Fx):
                 pp = "FreeBSD";                  pp = "FreeBSD";

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

CVSweb