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

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

version 1.97, 2009/07/28 10:15:12 version 1.98, 2009/09/15 08:16:20
Line 104  term_alloc(enum termenc enc)
Line 104  term_alloc(enum termenc enc)
         struct termp *p;          struct termp *p;
   
         if (NULL == (p = malloc(sizeof(struct termp))))          if (NULL == (p = malloc(sizeof(struct termp))))
                 err(1, "malloc");                  return(NULL);
         bzero(p, sizeof(struct termp));          bzero(p, sizeof(struct termp));
         p->maxrmargin = 78;          p->maxrmargin = 78;
         p->enc = enc;          p->enc = enc;
Line 492  do_escaped(struct termp *p, const char **word)
Line 492  do_escaped(struct termp *p, const char **word)
   
                 switch (*wp) {                  switch (*wp) {
                 case ('B'):                  case ('B'):
                         p->flags |= TERMP_BOLD;                          p->bold++;
                         break;                          break;
                 case ('I'):                  case ('I'):
                         p->flags |= TERMP_UNDER;                          p->under++;
                         break;                          break;
                 case ('P'):                  case ('P'):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case ('R'):                  case ('R'):
                         p->flags &= ~TERMP_STYLE;                          p->bold = p->under = 0;
                         break;                          break;
                 default:                  default:
                         break;                          break;
Line 579  buffer(struct termp *p, char c)
Line 579  buffer(struct termp *p, char c)
                 s = p->maxcols * 2;                  s = p->maxcols * 2;
                 p->buf = realloc(p->buf, s);                  p->buf = realloc(p->buf, s);
                 if (NULL == p->buf)                  if (NULL == p->buf)
                         err(1, "realloc");                          err(1, "realloc"); /* FIXME: shouldn't be here! */
                 p->maxcols = s;                  p->maxcols = s;
         }          }
         p->buf[(int)(p->col)++] = c;          p->buf[(int)(p->col)++] = c;
Line 590  static void
Line 590  static void
 encode(struct termp *p, char c)  encode(struct termp *p, char c)
 {  {
   
         if (' ' != c && TERMP_STYLE & p->flags) {          if (' ' != c) {
                 if (TERMP_BOLD & p->flags) {                  if (p->bold) {
                         buffer(p, c);                          buffer(p, c);
                         buffer(p, 8);                          buffer(p, 8);
                 }                  }
                 if (TERMP_UNDER & p->flags) {                  if (p->under) {
                         buffer(p, '_');                          buffer(p, '_');
                         buffer(p, 8);                          buffer(p, 8);
                 }                  }

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

CVSweb