Print this page
9718 update mandoc to 1.14.4

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mandoc/man_term.c
          +++ new/usr/src/cmd/mandoc/man_term.c
   1      -/*      $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
        1 +/*      $Id: man_term.c,v 1.211 2018/06/10 15:12:35 schwarze Exp $ */
   2    2  /*
   3    3   * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
   4      - * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
        4 + * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
   5    5   *
   6    6   * Permission to use, copy, modify, and distribute this software for any
   7    7   * purpose with or without fee is hereby granted, provided that the above
   8    8   * copyright notice and this permission notice appear in all copies.
   9    9   *
  10   10   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11   11   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12   12   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  13   13   * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14   14   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
↓ open down ↓ 653 lines elided ↑ open up ↑
 668  668  
 669  669                  /*
 670  670                   * No vertical space before the first subsection
 671  671                   * and after an empty subsection.
 672  672                   */
 673  673  
 674  674                  do {
 675  675                          n = n->prev;
 676  676                  } while (n != NULL && n->tok >= MAN_TH &&
 677  677                      termacts[n->tok].flags & MAN_NOTEXT);
 678      -                if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
      678 +                if (n == NULL || n->type == ROFFT_COMMENT ||
      679 +                    (n->tok == MAN_SS && n->body->child == NULL))
 679  680                          break;
 680  681  
 681  682                  for (i = 0; i < mt->pardist; i++)
 682  683                          term_vspace(p);
 683  684                  break;
 684  685          case ROFFT_HEAD:
 685  686                  term_fontrepl(p, TERMFONT_BOLD);
 686  687                  p->tcol->offset = term_len(p, 3);
 687  688                  p->tcol->rmargin = mt->offset;
 688  689                  p->trailspace = mt->offset;
↓ open down ↓ 41 lines elided ↑ open up ↑
 730  731  
 731  732                  /*
 732  733                   * No vertical space before the first section
 733  734                   * and after an empty section.
 734  735                   */
 735  736  
 736  737                  do {
 737  738                          n = n->prev;
 738  739                  } while (n != NULL && n->tok >= MAN_TH &&
 739  740                      termacts[n->tok].flags & MAN_NOTEXT);
 740      -                if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
      741 +                if (n == NULL || n->type == ROFFT_COMMENT ||
      742 +                    (n->tok == MAN_SH && n->body->child == NULL))
 741  743                          break;
 742  744  
 743  745                  for (i = 0; i < mt->pardist; i++)
 744  746                          term_vspace(p);
 745  747                  break;
 746  748          case ROFFT_HEAD:
 747  749                  term_fontrepl(p, TERMFONT_BOLD);
 748  750                  p->tcol->offset = 0;
 749  751                  p->tcol->rmargin = mt->offset;
 750  752                  p->trailspace = mt->offset;
↓ open down ↓ 127 lines elided ↑ open up ↑
 878  880                                  term_newln(p);
 879  881                          else
 880  882                                  term_vspace(p);
 881  883                          return;
 882  884                  } else if (*n->string == ' ' && n->flags & NODE_LINE &&
 883  885                      (p->flags & TERMP_NONEWLINE) == 0)
 884  886                          term_newln(p);
 885  887  
 886  888                  term_word(p, n->string);
 887  889                  goto out;
 888      -
      890 +        case ROFFT_COMMENT:
      891 +                return;
 889  892          case ROFFT_EQN:
 890  893                  if ( ! (n->flags & NODE_LINE))
 891  894                          p->flags |= TERMP_NOSPACE;
 892  895                  term_eqn(p, n->eqn);
 893  896                  if (n->next != NULL && ! (n->next->flags & NODE_LINE))
 894  897                          p->flags |= TERMP_NOSPACE;
 895  898                  return;
 896  899          case ROFFT_TBL:
 897  900                  if (p->tbl.cols == NULL)
 898  901                          term_vspace(p);
↓ open down ↓ 123 lines elided ↑ open up ↑
1022 1025          /* Bottom right corner: manual title and section. */
1023 1026  
1024 1027          p->flags &= ~TERMP_NOBREAK;
1025 1028          p->flags |= TERMP_NOSPACE;
1026 1029          p->trailspace = 0;
1027 1030          p->tcol->offset = p->tcol->rmargin;
1028 1031          p->tcol->rmargin = p->maxrmargin;
1029 1032  
1030 1033          term_word(p, title);
1031 1034          term_flushln(p);
     1035 +
     1036 +        /*
     1037 +         * Reset the terminal state for more output after the footer:
     1038 +         * Some output modes, in particular PostScript and PDF, print
     1039 +         * the header and the footer into a buffer such that it can be
     1040 +         * reused for multiple output pages, then go on to format the
     1041 +         * main text.
     1042 +         */
     1043 +
     1044 +        p->tcol->offset = 0;
     1045 +        p->flags = 0;
     1046 +
1032 1047          free(title);
1033 1048  }
1034 1049  
1035 1050  static void
1036 1051  print_man_head(struct termp *p, const struct roff_meta *meta)
1037 1052  {
1038 1053          const char              *volume;
1039 1054          char                    *title;
1040 1055          size_t                   vollen, titlen;
1041 1056  
↓ open down ↓ 60 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX