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

Diff for /mandoc/Attic/mdocterm.c between version 1.13 and 1.15

version 1.13, 2009/02/25 17:02:47 version 1.15, 2009/02/26 17:11:38
Line 168  flushln(struct termp *p)
Line 168  flushln(struct termp *p)
                  * the line with TERMP_NOBREAK).                   * the line with TERMP_NOBREAK).
                  */                   */
   
                 if (vis && vis + vsz >= maxvis) {                  if (vis && vis + vsz > maxvis) {
                         /* FIXME */                          /* FIXME */
                         if (p->flags & TERMP_NOBREAK)                          if (p->flags & TERMP_NOBREAK)
                                 errx(1, "word breaks right margin");                                  errx(1, "word breaks right margin");
Line 176  flushln(struct termp *p)
Line 176  flushln(struct termp *p)
                         for (j = 0; j < p->offset; j++)                          for (j = 0; j < p->offset; j++)
                                 putchar(' ');                                  putchar(' ');
                         vis = 0;                          vis = 0;
                 } else if (vis + vsz >= maxvis)                  } else if (vis + vsz > maxvis)
                         /* FIXME */                          /* FIXME */
                         errx(1, "word breaks right margin");                          errx(1, "word breaks right margin");
   
Line 203  flushln(struct termp *p)
Line 203  flushln(struct termp *p)
          */           */
   
         if (p->flags & TERMP_NOBREAK) {          if (p->flags & TERMP_NOBREAK) {
                 for ( ; vis < maxvis; vis++)                  if ( ! (p->flags & TERMP_NORPAD))
                         putchar(' ');                          for ( ; vis < maxvis; vis++)
                                   putchar(' ');
         } else          } else
                 putchar('\n');                  putchar('\n');
   
Line 487  footer(struct termp *p, const struct mdoc_meta *meta)
Line 488  footer(struct termp *p, const struct mdoc_meta *meta)
 {  {
         struct tm       *tm;          struct tm       *tm;
         char            *buf, *os;          char            *buf, *os;
         size_t           sz, osz, ssz, i;  
   
         if (NULL == (buf = malloc(p->rmargin)))          if (NULL == (buf = malloc(p->rmargin)))
                 err(1, "malloc");                  err(1, "malloc");
Line 503  footer(struct termp *p, const struct mdoc_meta *meta)
Line 503  footer(struct termp *p, const struct mdoc_meta *meta)
 #endif  #endif
                 err(1, "strftime");                  err(1, "strftime");
   
         osz = strlcpy(os, meta->os, p->rmargin);          (void)strlcpy(os, meta->os, p->rmargin);
   
         sz = strlen(buf);          vspace(p);
         ssz = sz + osz + 1;  
   
         if (ssz > p->rmargin) {          p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
                 ssz -= p->rmargin;          p->rmargin = p->maxrmargin - strlen(buf);
                 assert(ssz <= osz);          p->offset = 0;
                 os[osz - ssz] = 0;  
                 ssz = 1;  
         } else  
                 ssz = p->rmargin - ssz + 1;  
   
         printf("\n");          word(p, os);
         printf("%s", os);          flushln(p);
         for (i = 0; i < ssz; i++)  
                 printf(" ");  
   
         printf("%s\n", buf);          p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
         fflush(stdout);          p->offset = p->rmargin;
           p->rmargin = p->maxrmargin;
           p->flags &= ~TERMP_NOBREAK;
   
           word(p, buf);
           flushln(p);
   
         free(buf);          free(buf);
         free(os);          free(os);
 }  }
Line 584  header(struct termp *p, const struct mdoc_meta *meta)
Line 582  header(struct termp *p, const struct mdoc_meta *meta)
   
         p->offset = 0;          p->offset = 0;
         p->rmargin = (p->maxrmargin - strlen(buf)) / 2;          p->rmargin = (p->maxrmargin - strlen(buf)) / 2;
         p->flags |= TERMP_NOBREAK;          p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
         p->flags |= TERMP_NOSPACE;  
   
         word(p, title);          word(p, title);
         flushln(p);          flushln(p);
   
           p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
         p->offset = p->rmargin;          p->offset = p->rmargin;
         p->rmargin += strlen(buf);          p->rmargin = p->maxrmargin - strlen(title);
   
         word(p, buf);          word(p, buf);
         flushln(p);          flushln(p);
   
         exit(1);  
   
         p->offset = p->rmargin;          p->offset = p->rmargin;
         p->rmargin = p->maxrmargin;          p->rmargin = p->maxrmargin;
         p->flags &= ~TERMP_NOBREAK;          p->flags &= ~TERMP_NOBREAK;
           p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
   
         word(p, title);          word(p, title);
         flushln(p);          flushln(p);

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.15

CVSweb