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

Diff for /mandoc/man_term.c between version 1.45 and 1.48

version 1.45, 2009/10/26 04:09:45 version 1.48, 2009/11/05 08:37:12
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 353  pre_RI(DECL_ARGS)
Line 352  pre_RI(DECL_ARGS)
         int              i;          int              i;
   
         for (i = 0, nn = n->child; nn; nn = nn->next, i++) {          for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
                 if ( ! (i % 2))                  if (i % 2)
                         p->under++;                          p->under++;
                 if (i > 0)                  if (i > 0)
                         p->flags |= TERMP_NOSPACE;                          p->flags |= TERMP_NOSPACE;
                 print_man_node(p, mt, nn, m);                  print_man_node(p, mt, nn, m);
                 if ( ! (i % 2))                  if (i % 2)
                         p->under--;                          p->under--;
         }          }
         return(0);          return(0);
Line 939  print_man_foot(struct termp *p, const struct man_meta 
Line 938  print_man_foot(struct termp *p, const struct man_meta 
   
   
 static void  static void
 print_man_head(struct termp *p, const struct man_meta *meta)  print_man_head(struct termp *p, const struct man_meta *m)
 {  {
         char            *buf, *title;          char            buf[BUFSIZ], title[BUFSIZ];
   
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
         p->offset = 0;          p->offset = 0;
           buf[0] = title[0] = '\0';
   
         if (NULL == (buf = malloc(p->rmargin)))          if (m->vol)
                 err(EXIT_FAILURE, "malloc");                  strlcpy(buf, m->vol, BUFSIZ);
         if (NULL == (title = malloc(p->rmargin)))  
                 err(EXIT_FAILURE, "malloc");  
   
         if (meta->vol)          snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec);
                 (void)strlcpy(buf, meta->vol, p->rmargin);  
         else  
                 *buf = 0;  
   
         (void)snprintf(title, p->rmargin, "%s(%d)",  
                         meta->title, meta->msec);  
   
         p->offset = 0;          p->offset = 0;
         p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2;          p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2;
         p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;          p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
Line 984  print_man_head(struct termp *p, const struct man_meta 
Line 976  print_man_head(struct termp *p, const struct man_meta 
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
         p->offset = 0;          p->offset = 0;
         p->flags &= ~TERMP_NOSPACE;          p->flags &= ~TERMP_NOSPACE;
   
         free(title);  
         free(buf);  
 }  }
   

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.48

CVSweb