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

Diff for /mandoc/mdoc_man.c between version 1.107 and 1.108

version 1.107, 2017/04/17 12:53:29 version 1.108, 2017/04/17 13:26:47
Line 44  static int   cond_body(DECL_ARGS);
Line 44  static int   cond_body(DECL_ARGS);
 static  int       cond_head(DECL_ARGS);  static  int       cond_head(DECL_ARGS);
 static  void      font_push(char);  static  void      font_push(char);
 static  void      font_pop(void);  static  void      font_pop(void);
   static  int       man_strlen(const char *);
 static  void      mid_it(void);  static  void      mid_it(void);
 static  void      post__t(DECL_ARGS);  static  void      post__t(DECL_ARGS);
 static  void      post_aq(DECL_ARGS);  static  void      post_aq(DECL_ARGS);
Line 274  static struct {
Line 275  static struct {
 }       fontqueue;  }       fontqueue;
   
   
   static int
   man_strlen(const char *cp)
   {
           size_t   rsz;
           int      skip, sz;
   
           sz = 0;
           skip = 0;
           for (;;) {
                   rsz = strcspn(cp, "\\");
                   if (rsz) {
                           cp += rsz;
                           if (skip) {
                                   skip = 0;
                                   rsz--;
                           }
                           sz += rsz;
                   }
                   if ('\0' == *cp)
                           break;
                   cp++;
                   switch (mandoc_escape(&cp, NULL, NULL)) {
                   case ESCAPE_ERROR:
                           return sz;
                   case ESCAPE_UNICODE:
                   case ESCAPE_NUMBERED:
                   case ESCAPE_SPECIAL:
                   case ESCAPE_OVERSTRIKE:
                           if (skip)
                                   skip = 0;
                           else
                                   sz++;
                           break;
                   case ESCAPE_SKIPCHAR:
                           skip = 1;
                           break;
                   default:
                           break;
                   }
           }
           return sz;
   }
   
 static void  static void
 font_push(char newfont)  font_push(char newfont)
 {  {
Line 447  print_offs(const char *v, int keywords)
Line 491  print_offs(const char *v, int keywords)
                         return;                          return;
                 }                  }
         } else          } else
                 sz = strlen(v);                  sz = man_strlen(v);
   
         /*          /*
          * We are inside an enclosing list.           * We are inside an enclosing list.
Line 485  print_width(const struct mdoc_bl *bl, const struct rof
Line 529  print_width(const struct mdoc_bl *bl, const struct rof
                         numeric = 0;                          numeric = 0;
                 }                  }
         } else          } else
                 sz = strlen(bl->width);                  sz = man_strlen(bl->width);
   
         /* XXX Rough estimation, might have multiple parts. */          /* XXX Rough estimation, might have multiple parts. */
         if (bl->type == LIST_enum)          if (bl->type == LIST_enum)
                 chsz = (bl->count > 8) + 1;                  chsz = (bl->count > 8) + 1;
         else if (child != NULL && child->type == ROFFT_TEXT)          else if (child != NULL && child->type == ROFFT_TEXT)
                 chsz = strlen(child->string);                  chsz = man_strlen(child->string);
         else          else
                 chsz = 0;                  chsz = 0;
   
Line 1464  static int
Line 1508  static int
 pre_lk(DECL_ARGS)  pre_lk(DECL_ARGS)
 {  {
         const struct roff_node *link, *descr;          const struct roff_node *link, *descr;
           int display;
   
         if ((link = n->child) == NULL)          if ((link = n->child) == NULL)
                 return 0;                  return 0;
Line 1480  pre_lk(DECL_ARGS)
Line 1525  pre_lk(DECL_ARGS)
         }          }
   
         /* Link target. */          /* Link target. */
           display = man_strlen(link->string) >= 26;
           if (display) {
                   print_line(".RS", MMAN_Bk_susp);
                   print_word("6n");
                   outflags |= MMAN_nl;
           }
         font_push('B');          font_push('B');
         print_word(link->string);          print_word(link->string);
         font_pop();          font_pop();
Line 1489  pre_lk(DECL_ARGS)
Line 1540  pre_lk(DECL_ARGS)
                 print_word(descr->string);                  print_word(descr->string);
                 descr = descr->next;                  descr = descr->next;
         }          }
           if (display)
                   print_line(".RE", MMAN_nl);
         return 0;          return 0;
 }  }
   
Line 1526  pre_nm(DECL_ARGS)
Line 1579  pre_nm(DECL_ARGS)
                 if (NULL == n->parent->prev)                  if (NULL == n->parent->prev)
                         outflags |= MMAN_sp;                          outflags |= MMAN_sp;
                 print_block(".HP", 0);                  print_block(".HP", 0);
                 printf(" %zun", strlen(name) + 1);                  printf(" %dn", man_strlen(name) + 1);
                 outflags |= MMAN_nl;                  outflags |= MMAN_nl;
         }          }
         font_push('B');          font_push('B');

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.108

CVSweb