Annotation of mandoc/man_term.c, Revision 1.152
1.152 ! schwarze 1: /* $Id: man_term.c,v 1.151 2014/09/03 05:22:45 schwarze Exp $ */
1.1 kristaps 2: /*
1.128 schwarze 3: * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
1.140 schwarze 4: * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 5: *
6: * Permission to use, copy, modify, and distribute this software for any
1.8 kristaps 7: * purpose with or without fee is hereby granted, provided that the above
8: * copyright notice and this permission notice appear in all copies.
1.1 kristaps 9: *
1.8 kristaps 10: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 kristaps 17: */
1.55 kristaps 18: #include "config.h"
19:
1.28 kristaps 20: #include <sys/types.h>
21:
1.1 kristaps 22: #include <assert.h>
1.18 kristaps 23: #include <ctype.h>
1.1 kristaps 24: #include <stdio.h>
25: #include <stdlib.h>
26: #include <string.h>
27:
1.71 kristaps 28: #include "mandoc.h"
1.147 schwarze 29: #include "mandoc_aux.h"
1.40 kristaps 30: #include "out.h"
1.36 kristaps 31: #include "man.h"
1.1 kristaps 32: #include "term.h"
1.36 kristaps 33: #include "main.h"
1.1 kristaps 34:
1.116 schwarze 35: #define MAXMARGINS 64 /* maximum number of indented scopes */
1.18 kristaps 36:
1.24 kristaps 37: struct mtermp {
38: int fl;
1.19 kristaps 39: #define MANT_LITERAL (1 << 0)
1.116 schwarze 40: size_t lmargin[MAXMARGINS]; /* margins (incl. visible page) */
41: int lmargincur; /* index of current margin */
42: int lmarginsz; /* actual number of nested margins */
43: size_t offset; /* default offset to visible page */
1.134 schwarze 44: int pardist; /* vert. space before par., unit: [v] */
1.24 kristaps 45: };
1.19 kristaps 46:
1.146 schwarze 47: #define DECL_ARGS struct termp *p, \
1.24 kristaps 48: struct mtermp *mt, \
1.1 kristaps 49: const struct man_node *n, \
1.135 schwarze 50: const struct man_meta *meta
1.1 kristaps 51:
52: struct termact {
53: int (*pre)(DECL_ARGS);
54: void (*post)(DECL_ARGS);
1.56 kristaps 55: int flags;
56: #define MAN_NOTEXT (1 << 0) /* Never has text children. */
1.1 kristaps 57: };
58:
1.77 kristaps 59: static int a2width(const struct termp *, const char *);
60: static size_t a2height(const struct termp *, const char *);
1.39 kristaps 61:
1.52 kristaps 62: static void print_man_nodelist(DECL_ARGS);
1.45 kristaps 63: static void print_man_node(DECL_ARGS);
1.74 kristaps 64: static void print_man_head(struct termp *, const void *);
1.73 kristaps 65: static void print_man_foot(struct termp *, const void *);
1.146 schwarze 66: static void print_bvspace(struct termp *,
1.134 schwarze 67: const struct man_node *, int);
1.39 kristaps 68:
1.1 kristaps 69: static int pre_B(DECL_ARGS);
1.19 kristaps 70: static int pre_HP(DECL_ARGS);
1.1 kristaps 71: static int pre_I(DECL_ARGS);
1.4 kristaps 72: static int pre_IP(DECL_ARGS);
1.127 kristaps 73: static int pre_OP(DECL_ARGS);
1.134 schwarze 74: static int pre_PD(DECL_ARGS);
1.1 kristaps 75: static int pre_PP(DECL_ARGS);
1.26 kristaps 76: static int pre_RS(DECL_ARGS);
1.1 kristaps 77: static int pre_SH(DECL_ARGS);
78: static int pre_SS(DECL_ARGS);
79: static int pre_TP(DECL_ARGS);
1.137 schwarze 80: static int pre_UR(DECL_ARGS);
1.127 kristaps 81: static int pre_alternate(DECL_ARGS);
82: static int pre_ft(DECL_ARGS);
1.29 kristaps 83: static int pre_ign(DECL_ARGS);
1.83 kristaps 84: static int pre_in(DECL_ARGS);
1.84 kristaps 85: static int pre_literal(DECL_ARGS);
1.143 schwarze 86: static int pre_ll(DECL_ARGS);
1.19 kristaps 87: static int pre_sp(DECL_ARGS);
1.1 kristaps 88:
1.22 kristaps 89: static void post_IP(DECL_ARGS);
1.20 kristaps 90: static void post_HP(DECL_ARGS);
1.26 kristaps 91: static void post_RS(DECL_ARGS);
1.1 kristaps 92: static void post_SH(DECL_ARGS);
93: static void post_SS(DECL_ARGS);
1.21 kristaps 94: static void post_TP(DECL_ARGS);
1.137 schwarze 95: static void post_UR(DECL_ARGS);
1.1 kristaps 96:
1.32 kristaps 97: static const struct termact termacts[MAN_MAX] = {
1.82 kristaps 98: { pre_sp, NULL, MAN_NOTEXT }, /* br */
1.56 kristaps 99: { NULL, NULL, 0 }, /* TH */
100: { pre_SH, post_SH, 0 }, /* SH */
101: { pre_SS, post_SS, 0 }, /* SS */
102: { pre_TP, post_TP, 0 }, /* TP */
103: { pre_PP, NULL, 0 }, /* LP */
104: { pre_PP, NULL, 0 }, /* PP */
105: { pre_PP, NULL, 0 }, /* P */
106: { pre_IP, post_IP, 0 }, /* IP */
1.146 schwarze 107: { pre_HP, post_HP, 0 }, /* HP */
1.56 kristaps 108: { NULL, NULL, 0 }, /* SM */
109: { pre_B, NULL, 0 }, /* SB */
1.88 kristaps 110: { pre_alternate, NULL, 0 }, /* BI */
111: { pre_alternate, NULL, 0 }, /* IB */
112: { pre_alternate, NULL, 0 }, /* BR */
113: { pre_alternate, NULL, 0 }, /* RB */
1.56 kristaps 114: { NULL, NULL, 0 }, /* R */
115: { pre_B, NULL, 0 }, /* B */
116: { pre_I, NULL, 0 }, /* I */
1.88 kristaps 117: { pre_alternate, NULL, 0 }, /* IR */
118: { pre_alternate, NULL, 0 }, /* RI */
1.99 schwarze 119: { pre_ign, NULL, MAN_NOTEXT }, /* na */
1.56 kristaps 120: { pre_sp, NULL, MAN_NOTEXT }, /* sp */
1.84 kristaps 121: { pre_literal, NULL, 0 }, /* nf */
122: { pre_literal, NULL, 0 }, /* fi */
1.56 kristaps 123: { NULL, NULL, 0 }, /* RE */
124: { pre_RS, post_RS, 0 }, /* RS */
125: { pre_ign, NULL, 0 }, /* DT */
126: { pre_ign, NULL, 0 }, /* UC */
1.134 schwarze 127: { pre_PD, NULL, MAN_NOTEXT }, /* PD */
1.70 joerg 128: { pre_ign, NULL, 0 }, /* AT */
1.83 kristaps 129: { pre_in, NULL, MAN_NOTEXT }, /* in */
1.89 kristaps 130: { pre_ft, NULL, MAN_NOTEXT }, /* ft */
1.127 kristaps 131: { pre_OP, NULL, 0 }, /* OP */
1.129 schwarze 132: { pre_literal, NULL, 0 }, /* EX */
133: { pre_literal, NULL, 0 }, /* EE */
1.137 schwarze 134: { pre_UR, post_UR, 0 }, /* UR */
135: { NULL, NULL, 0 }, /* UE */
1.143 schwarze 136: { pre_ll, NULL, MAN_NOTEXT }, /* ll */
1.1 kristaps 137: };
138:
139:
1.31 kristaps 140: void
1.36 kristaps 141: terminal_man(void *arg, const struct man *man)
1.1 kristaps 142: {
1.36 kristaps 143: struct termp *p;
1.135 schwarze 144: const struct man_meta *meta;
1.151 schwarze 145: struct man_node *n;
1.36 kristaps 146: struct mtermp mt;
147:
148: p = (struct termp *)arg;
149:
1.58 kristaps 150: p->overstep = 0;
1.151 schwarze 151: p->rmargin = p->maxrmargin = p->defrmargin;
1.77 kristaps 152: p->tabwidth = term_len(p, 5);
1.73 kristaps 153:
1.36 kristaps 154: if (NULL == p->symtab)
1.109 kristaps 155: p->symtab = mchars_alloc();
1.36 kristaps 156:
1.151 schwarze 157: n = man_node(man)->child;
1.135 schwarze 158: meta = man_meta(man);
1.1 kristaps 159:
1.116 schwarze 160: memset(&mt, 0, sizeof(struct mtermp));
161:
1.122 schwarze 162: mt.lmargin[mt.lmargincur] = term_len(p, p->defindent);
163: mt.offset = term_len(p, p->defindent);
1.134 schwarze 164: mt.pardist = 1;
1.24 kristaps 165:
1.151 schwarze 166: if (p->synopsisonly) {
167: while (n != NULL) {
168: if (n->tok == MAN_SH &&
169: n->child->child->type == MAN_TEXT &&
170: !strcmp(n->child->child->string, "SYNOPSIS")) {
171: if (n->child->next->child != NULL)
172: print_man_nodelist(p, &mt,
173: n->child->next->child, meta);
174: term_newln(p);
175: break;
176: }
177: n = n->next;
178: }
179: } else {
180: if (p->defindent == 0)
181: p->defindent = 7;
182: term_begin(p, print_man_head, print_man_foot, meta);
183: p->flags |= TERMP_NOSPACE;
184: if (n != NULL)
185: print_man_nodelist(p, &mt, n, meta);
186: term_end(p);
187: }
1.1 kristaps 188: }
189:
190:
1.77 kristaps 191: static size_t
192: a2height(const struct termp *p, const char *cp)
1.18 kristaps 193: {
1.40 kristaps 194: struct roffsu su;
1.18 kristaps 195:
1.77 kristaps 196: if ( ! a2roffsu(cp, &su, SCALE_VS))
1.112 kristaps 197: SCALE_VS_INIT(&su, atoi(cp));
1.18 kristaps 198:
1.77 kristaps 199: return(term_vspan(p, &su));
1.18 kristaps 200: }
201:
202: static int
1.77 kristaps 203: a2width(const struct termp *p, const char *cp)
1.38 kristaps 204: {
1.40 kristaps 205: struct roffsu su;
1.38 kristaps 206:
1.77 kristaps 207: if ( ! a2roffsu(cp, &su, SCALE_BU))
1.41 kristaps 208: return(-1);
1.40 kristaps 209:
1.77 kristaps 210: return((int)term_hspan(p, &su));
1.38 kristaps 211: }
212:
1.111 kristaps 213: /*
214: * Printing leading vertical space before a block.
215: * This is used for the paragraph macros.
216: * The rules are pretty simple, since there's very little nesting going
217: * on here. Basically, if we're the first within another block (SS/SH),
218: * then don't emit vertical space. If we are (RS), then do. If not the
219: * first, print it.
220: */
1.39 kristaps 221: static void
1.134 schwarze 222: print_bvspace(struct termp *p, const struct man_node *n, int pardist)
1.18 kristaps 223: {
1.134 schwarze 224: int i;
1.111 kristaps 225:
1.39 kristaps 226: term_newln(p);
1.101 schwarze 227:
1.111 kristaps 228: if (n->body && n->body->child)
229: if (MAN_TBL == n->body->child->type)
230: return;
231:
232: if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
233: if (NULL == n->prev)
234: return;
1.18 kristaps 235:
1.134 schwarze 236: for (i = 0; i < pardist; i++)
237: term_vspace(p);
1.18 kristaps 238: }
239:
1.146 schwarze 240:
1.1 kristaps 241: static int
1.29 kristaps 242: pre_ign(DECL_ARGS)
243: {
244:
1.143 schwarze 245: return(0);
246: }
247:
248: static int
249: pre_ll(DECL_ARGS)
250: {
251:
1.144 schwarze 252: term_setwidth(p, n->nchild ? n->child->string : NULL);
1.29 kristaps 253: return(0);
254: }
255:
256: static int
1.1 kristaps 257: pre_I(DECL_ARGS)
258: {
259:
1.52 kristaps 260: term_fontrepl(p, TERMFONT_UNDER);
1.19 kristaps 261: return(1);
262: }
263:
1.3 kristaps 264: static int
1.84 kristaps 265: pre_literal(DECL_ARGS)
1.19 kristaps 266: {
267:
1.81 kristaps 268: term_newln(p);
1.88 kristaps 269:
1.129 schwarze 270: if (MAN_nf == n->tok || MAN_EX == n->tok)
1.84 kristaps 271: mt->fl |= MANT_LITERAL;
1.88 kristaps 272: else
1.84 kristaps 273: mt->fl &= ~MANT_LITERAL;
274:
1.117 schwarze 275: /*
276: * Unlike .IP and .TP, .HP does not have a HEAD.
277: * So in case a second call to term_flushln() is needed,
278: * indentation has to be set up explicitly.
279: */
280: if (MAN_HP == n->parent->tok && p->rmargin < p->maxrmargin) {
1.121 schwarze 281: p->offset = p->rmargin;
1.117 schwarze 282: p->rmargin = p->maxrmargin;
1.139 schwarze 283: p->trailspace = 0;
1.145 schwarze 284: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
1.117 schwarze 285: p->flags |= TERMP_NOSPACE;
286: }
287:
1.99 schwarze 288: return(0);
1.19 kristaps 289: }
290:
291: static int
1.134 schwarze 292: pre_PD(DECL_ARGS)
293: {
294:
295: n = n->child;
296: if (0 == n) {
297: mt->pardist = 1;
298: return(0);
299: }
300: assert(MAN_TEXT == n->type);
301: mt->pardist = atoi(n->string);
302: return(0);
303: }
304:
305: static int
1.88 kristaps 306: pre_alternate(DECL_ARGS)
1.3 kristaps 307: {
1.88 kristaps 308: enum termfont font[2];
309: const struct man_node *nn;
310: int savelit, i;
1.3 kristaps 311:
1.88 kristaps 312: switch (n->tok) {
1.146 schwarze 313: case MAN_RB:
1.88 kristaps 314: font[0] = TERMFONT_NONE;
315: font[1] = TERMFONT_BOLD;
316: break;
1.146 schwarze 317: case MAN_RI:
1.88 kristaps 318: font[0] = TERMFONT_NONE;
319: font[1] = TERMFONT_UNDER;
320: break;
1.146 schwarze 321: case MAN_BR:
1.88 kristaps 322: font[0] = TERMFONT_BOLD;
323: font[1] = TERMFONT_NONE;
324: break;
1.146 schwarze 325: case MAN_BI:
1.88 kristaps 326: font[0] = TERMFONT_BOLD;
327: font[1] = TERMFONT_UNDER;
328: break;
1.146 schwarze 329: case MAN_IR:
1.88 kristaps 330: font[0] = TERMFONT_UNDER;
331: font[1] = TERMFONT_NONE;
332: break;
1.146 schwarze 333: case MAN_IB:
1.88 kristaps 334: font[0] = TERMFONT_UNDER;
335: font[1] = TERMFONT_BOLD;
336: break;
337: default:
338: abort();
339: }
1.35 kristaps 340:
1.88 kristaps 341: savelit = MANT_LITERAL & mt->fl;
342: mt->fl &= ~MANT_LITERAL;
1.35 kristaps 343:
1.88 kristaps 344: for (i = 0, nn = n->child; nn; nn = nn->next, i = 1 - i) {
345: term_fontrepl(p, font[i]);
346: if (savelit && NULL == nn->next)
347: mt->fl |= MANT_LITERAL;
1.135 schwarze 348: print_man_node(p, mt, nn, meta);
1.88 kristaps 349: if (nn->next)
1.4 kristaps 350: p->flags |= TERMP_NOSPACE;
1.3 kristaps 351: }
352:
353: return(0);
354: }
355:
1.1 kristaps 356: static int
357: pre_B(DECL_ARGS)
358: {
359:
1.52 kristaps 360: term_fontrepl(p, TERMFONT_BOLD);
1.1 kristaps 361: return(1);
1.127 kristaps 362: }
363:
364: static int
365: pre_OP(DECL_ARGS)
366: {
367:
368: term_word(p, "[");
369: p->flags |= TERMP_NOSPACE;
370:
371: if (NULL != (n = n->child)) {
372: term_fontrepl(p, TERMFONT_BOLD);
373: term_word(p, n->string);
374: }
375: if (NULL != n && NULL != n->next) {
376: term_fontrepl(p, TERMFONT_UNDER);
377: term_word(p, n->next->string);
378: }
379:
380: term_fontrepl(p, TERMFONT_NONE);
381: p->flags |= TERMP_NOSPACE;
382: term_word(p, "]");
383: return(0);
1.89 kristaps 384: }
385:
386: static int
387: pre_ft(DECL_ARGS)
388: {
389: const char *cp;
390:
391: if (NULL == n->child) {
392: term_fontlast(p);
393: return(0);
394: }
395:
396: cp = n->child->string;
397: switch (*cp) {
1.146 schwarze 398: case '4':
1.89 kristaps 399: /* FALLTHROUGH */
1.146 schwarze 400: case '3':
1.89 kristaps 401: /* FALLTHROUGH */
1.146 schwarze 402: case 'B':
1.89 kristaps 403: term_fontrepl(p, TERMFONT_BOLD);
404: break;
1.146 schwarze 405: case '2':
1.89 kristaps 406: /* FALLTHROUGH */
1.146 schwarze 407: case 'I':
1.89 kristaps 408: term_fontrepl(p, TERMFONT_UNDER);
409: break;
1.146 schwarze 410: case 'P':
1.89 kristaps 411: term_fontlast(p);
412: break;
1.146 schwarze 413: case '1':
1.89 kristaps 414: /* FALLTHROUGH */
1.146 schwarze 415: case 'C':
1.89 kristaps 416: /* FALLTHROUGH */
1.146 schwarze 417: case 'R':
1.89 kristaps 418: term_fontrepl(p, TERMFONT_NONE);
419: break;
420: default:
421: break;
422: }
423: return(0);
1.83 kristaps 424: }
425:
426: static int
427: pre_in(DECL_ARGS)
428: {
429: int len, less;
430: size_t v;
431: const char *cp;
432:
433: term_newln(p);
434:
435: if (NULL == n->child) {
436: p->offset = mt->offset;
437: return(0);
438: }
439:
440: cp = n->child->string;
441: less = 0;
442:
443: if ('-' == *cp)
444: less = -1;
445: else if ('+' == *cp)
446: less = 1;
447: else
448: cp--;
449:
450: if ((len = a2width(p, ++cp)) < 0)
451: return(0);
452:
453: v = (size_t)len;
454:
455: if (less < 0)
456: p->offset -= p->offset > v ? v : p->offset;
457: else if (less > 0)
458: p->offset += v;
1.146 schwarze 459: else
1.83 kristaps 460: p->offset = v;
1.95 kristaps 461:
462: /* Don't let this creep beyond the right margin. */
463:
464: if (p->offset > p->rmargin)
465: p->offset = p->rmargin;
1.83 kristaps 466:
467: return(0);
1.1 kristaps 468: }
469:
470: static int
1.19 kristaps 471: pre_sp(DECL_ARGS)
472: {
1.131 schwarze 473: char *s;
1.77 kristaps 474: size_t i, len;
1.131 schwarze 475: int neg;
1.112 kristaps 476:
477: if ((NULL == n->prev && n->parent)) {
1.132 schwarze 478: switch (n->parent->tok) {
1.146 schwarze 479: case MAN_SH:
1.132 schwarze 480: /* FALLTHROUGH */
1.146 schwarze 481: case MAN_SS:
1.132 schwarze 482: /* FALLTHROUGH */
1.146 schwarze 483: case MAN_PP:
1.132 schwarze 484: /* FALLTHROUGH */
1.146 schwarze 485: case MAN_LP:
1.132 schwarze 486: /* FALLTHROUGH */
1.146 schwarze 487: case MAN_P:
1.132 schwarze 488: /* FALLTHROUGH */
1.112 kristaps 489: return(0);
1.132 schwarze 490: default:
491: break;
492: }
1.112 kristaps 493: }
1.19 kristaps 494:
1.131 schwarze 495: neg = 0;
1.82 kristaps 496: switch (n->tok) {
1.146 schwarze 497: case MAN_br:
1.82 kristaps 498: len = 0;
499: break;
500: default:
1.131 schwarze 501: if (NULL == n->child) {
502: len = 1;
503: break;
504: }
505: s = n->child->string;
506: if ('-' == *s) {
507: neg = 1;
508: s++;
509: }
510: len = a2height(p, s);
1.82 kristaps 511: break;
512: }
1.38 kristaps 513:
1.19 kristaps 514: if (0 == len)
515: term_newln(p);
1.131 schwarze 516: else if (neg)
517: p->skipvsp += len;
518: else
519: for (i = 0; i < len; i++)
520: term_vspace(p);
1.19 kristaps 521:
1.15 kristaps 522: return(0);
523: }
524:
525: static int
1.19 kristaps 526: pre_HP(DECL_ARGS)
527: {
1.117 schwarze 528: size_t len, one;
1.24 kristaps 529: int ival;
530: const struct man_node *nn;
1.19 kristaps 531:
1.20 kristaps 532: switch (n->type) {
1.146 schwarze 533: case MAN_BLOCK:
1.134 schwarze 534: print_bvspace(p, n, mt->pardist);
1.24 kristaps 535: return(1);
1.146 schwarze 536: case MAN_BODY:
1.20 kristaps 537: break;
538: default:
539: return(0);
540: }
541:
1.130 schwarze 542: if ( ! (MANT_LITERAL & mt->fl)) {
1.145 schwarze 543: p->flags |= TERMP_NOBREAK | TERMP_BRIND;
1.139 schwarze 544: p->trailspace = 2;
1.130 schwarze 545: }
546:
1.116 schwarze 547: len = mt->lmargin[mt->lmargincur];
1.24 kristaps 548: ival = -1;
549:
550: /* Calculate offset. */
551:
1.39 kristaps 552: if (NULL != (nn = n->parent->head->child))
1.77 kristaps 553: if ((ival = a2width(p, nn->string)) >= 0)
1.24 kristaps 554: len = (size_t)ival;
555:
1.117 schwarze 556: one = term_len(p, 1);
1.121 schwarze 557: if (len < one)
1.117 schwarze 558: len = one;
1.24 kristaps 559:
1.26 kristaps 560: p->offset = mt->offset;
561: p->rmargin = mt->offset + len;
1.24 kristaps 562:
563: if (ival >= 0)
1.116 schwarze 564: mt->lmargin[mt->lmargincur] = (size_t)ival;
1.24 kristaps 565:
1.19 kristaps 566: return(1);
567: }
568:
1.20 kristaps 569: static void
570: post_HP(DECL_ARGS)
571: {
572:
573: switch (n->type) {
1.146 schwarze 574: case MAN_BODY:
1.136 schwarze 575: term_newln(p);
1.145 schwarze 576: p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
1.139 schwarze 577: p->trailspace = 0;
1.26 kristaps 578: p->offset = mt->offset;
1.20 kristaps 579: p->rmargin = p->maxrmargin;
580: break;
581: default:
582: break;
583: }
584: }
585:
1.19 kristaps 586: static int
1.1 kristaps 587: pre_PP(DECL_ARGS)
588: {
589:
1.19 kristaps 590: switch (n->type) {
1.146 schwarze 591: case MAN_BLOCK:
1.122 schwarze 592: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
1.134 schwarze 593: print_bvspace(p, n, mt->pardist);
1.19 kristaps 594: break;
595: default:
1.26 kristaps 596: p->offset = mt->offset;
1.19 kristaps 597: break;
598: }
599:
1.87 kristaps 600: return(MAN_HEAD != n->type);
1.1 kristaps 601: }
602:
603: static int
1.4 kristaps 604: pre_IP(DECL_ARGS)
605: {
1.22 kristaps 606: const struct man_node *nn;
607: size_t len;
1.94 schwarze 608: int savelit, ival;
1.18 kristaps 609:
1.22 kristaps 610: switch (n->type) {
1.146 schwarze 611: case MAN_BODY:
1.22 kristaps 612: p->flags |= TERMP_NOSPACE;
613: break;
1.146 schwarze 614: case MAN_HEAD:
1.22 kristaps 615: p->flags |= TERMP_NOBREAK;
1.139 schwarze 616: p->trailspace = 1;
1.22 kristaps 617: break;
1.146 schwarze 618: case MAN_BLOCK:
1.134 schwarze 619: print_bvspace(p, n, mt->pardist);
1.23 kristaps 620: /* FALLTHROUGH */
1.22 kristaps 621: default:
622: return(1);
623: }
1.18 kristaps 624:
1.116 schwarze 625: len = mt->lmargin[mt->lmargincur];
1.22 kristaps 626: ival = -1;
1.4 kristaps 627:
1.94 schwarze 628: /* Calculate the offset from the optional second argument. */
1.22 kristaps 629: if (NULL != (nn = n->parent->head->child))
1.94 schwarze 630: if (NULL != (nn = nn->next))
1.77 kristaps 631: if ((ival = a2width(p, nn->string)) >= 0)
1.22 kristaps 632: len = (size_t)ival;
1.4 kristaps 633:
1.22 kristaps 634: switch (n->type) {
1.146 schwarze 635: case MAN_HEAD:
1.23 kristaps 636: /* Handle zero-width lengths. */
637: if (0 == len)
1.77 kristaps 638: len = term_len(p, 1);
1.23 kristaps 639:
1.26 kristaps 640: p->offset = mt->offset;
641: p->rmargin = mt->offset + len;
1.22 kristaps 642: if (ival < 0)
643: break;
1.18 kristaps 644:
1.24 kristaps 645: /* Set the saved left-margin. */
1.116 schwarze 646: mt->lmargin[mt->lmargincur] = (size_t)ival;
1.24 kristaps 647:
1.94 schwarze 648: savelit = MANT_LITERAL & mt->fl;
649: mt->fl &= ~MANT_LITERAL;
650:
651: if (n->child)
1.135 schwarze 652: print_man_node(p, mt, n->child, meta);
1.94 schwarze 653:
654: if (savelit)
655: mt->fl |= MANT_LITERAL;
656:
1.22 kristaps 657: return(0);
1.146 schwarze 658: case MAN_BODY:
1.26 kristaps 659: p->offset = mt->offset + len;
1.140 schwarze 660: p->rmargin = p->maxrmargin > p->offset ?
1.146 schwarze 661: p->maxrmargin : p->offset;
1.23 kristaps 662: break;
1.22 kristaps 663: default:
664: break;
1.18 kristaps 665: }
666:
1.22 kristaps 667: return(1);
668: }
1.18 kristaps 669:
1.22 kristaps 670: static void
671: post_IP(DECL_ARGS)
672: {
1.4 kristaps 673:
1.22 kristaps 674: switch (n->type) {
1.146 schwarze 675: case MAN_HEAD:
1.22 kristaps 676: term_flushln(p);
677: p->flags &= ~TERMP_NOBREAK;
1.139 schwarze 678: p->trailspace = 0;
1.22 kristaps 679: p->rmargin = p->maxrmargin;
680: break;
1.146 schwarze 681: case MAN_BODY:
1.94 schwarze 682: term_newln(p);
1.138 schwarze 683: p->offset = mt->offset;
1.22 kristaps 684: break;
685: default:
686: break;
687: }
1.4 kristaps 688: }
689:
690: static int
1.1 kristaps 691: pre_TP(DECL_ARGS)
692: {
1.23 kristaps 693: const struct man_node *nn;
694: size_t len;
1.94 schwarze 695: int savelit, ival;
1.1 kristaps 696:
1.21 kristaps 697: switch (n->type) {
1.146 schwarze 698: case MAN_HEAD:
1.21 kristaps 699: p->flags |= TERMP_NOBREAK;
1.139 schwarze 700: p->trailspace = 1;
1.21 kristaps 701: break;
1.146 schwarze 702: case MAN_BODY:
1.21 kristaps 703: p->flags |= TERMP_NOSPACE;
1.23 kristaps 704: break;
1.146 schwarze 705: case MAN_BLOCK:
1.134 schwarze 706: print_bvspace(p, n, mt->pardist);
1.23 kristaps 707: /* FALLTHROUGH */
708: default:
709: return(1);
710: }
711:
1.116 schwarze 712: len = (size_t)mt->lmargin[mt->lmargincur];
1.23 kristaps 713: ival = -1;
714:
715: /* Calculate offset. */
716:
1.116 schwarze 717: if (NULL != (nn = n->parent->head->child))
1.141 schwarze 718: if (nn->string && 0 == (MAN_LINE & nn->flags))
1.77 kristaps 719: if ((ival = a2width(p, nn->string)) >= 0)
1.23 kristaps 720: len = (size_t)ival;
721:
722: switch (n->type) {
1.146 schwarze 723: case MAN_HEAD:
1.23 kristaps 724: /* Handle zero-length properly. */
725: if (0 == len)
1.77 kristaps 726: len = term_len(p, 1);
1.23 kristaps 727:
1.26 kristaps 728: p->offset = mt->offset;
729: p->rmargin = mt->offset + len;
1.23 kristaps 730:
1.94 schwarze 731: savelit = MANT_LITERAL & mt->fl;
732: mt->fl &= ~MANT_LITERAL;
733:
1.23 kristaps 734: /* Don't print same-line elements. */
1.141 schwarze 735: nn = n->child;
736: while (NULL != nn && 0 == (MAN_LINE & nn->flags))
737: nn = nn->next;
738:
739: while (NULL != nn) {
740: print_man_node(p, mt, nn, meta);
741: nn = nn->next;
742: }
1.24 kristaps 743:
1.94 schwarze 744: if (savelit)
745: mt->fl |= MANT_LITERAL;
1.24 kristaps 746: if (ival >= 0)
1.116 schwarze 747: mt->lmargin[mt->lmargincur] = (size_t)ival;
1.24 kristaps 748:
1.23 kristaps 749: return(0);
1.146 schwarze 750: case MAN_BODY:
1.26 kristaps 751: p->offset = mt->offset + len;
1.140 schwarze 752: p->rmargin = p->maxrmargin > p->offset ?
1.146 schwarze 753: p->maxrmargin : p->offset;
1.139 schwarze 754: p->trailspace = 0;
1.130 schwarze 755: p->flags &= ~TERMP_NOBREAK;
1.21 kristaps 756: break;
757: default:
758: break;
759: }
1.16 kristaps 760:
1.21 kristaps 761: return(1);
762: }
1.1 kristaps 763:
1.21 kristaps 764: static void
765: post_TP(DECL_ARGS)
766: {
1.1 kristaps 767:
1.21 kristaps 768: switch (n->type) {
1.146 schwarze 769: case MAN_HEAD:
1.21 kristaps 770: term_flushln(p);
771: break;
1.146 schwarze 772: case MAN_BODY:
1.94 schwarze 773: term_newln(p);
1.138 schwarze 774: p->offset = mt->offset;
1.21 kristaps 775: break;
776: default:
777: break;
778: }
1.1 kristaps 779: }
780:
781: static int
782: pre_SS(DECL_ARGS)
783: {
1.134 schwarze 784: int i;
1.1 kristaps 785:
1.19 kristaps 786: switch (n->type) {
1.146 schwarze 787: case MAN_BLOCK:
1.113 kristaps 788: mt->fl &= ~MANT_LITERAL;
1.122 schwarze 789: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
790: mt->offset = term_len(p, p->defindent);
1.24 kristaps 791: /* If following a prior empty `SS', no vspace. */
792: if (n->prev && MAN_SS == n->prev->tok)
793: if (NULL == n->prev->body->child)
794: break;
795: if (NULL == n->prev)
796: break;
1.134 schwarze 797: for (i = 0; i < mt->pardist; i++)
798: term_vspace(p);
1.19 kristaps 799: break;
1.146 schwarze 800: case MAN_HEAD:
1.52 kristaps 801: term_fontrepl(p, TERMFONT_BOLD);
1.133 schwarze 802: p->offset = term_len(p, 3);
1.19 kristaps 803: break;
1.146 schwarze 804: case MAN_BODY:
1.26 kristaps 805: p->offset = mt->offset;
1.24 kristaps 806: break;
1.19 kristaps 807: default:
808: break;
809: }
810:
1.1 kristaps 811: return(1);
812: }
813:
814: static void
815: post_SS(DECL_ARGS)
816: {
1.146 schwarze 817:
1.19 kristaps 818: switch (n->type) {
1.146 schwarze 819: case MAN_HEAD:
1.19 kristaps 820: term_newln(p);
821: break;
1.146 schwarze 822: case MAN_BODY:
1.24 kristaps 823: term_newln(p);
824: break;
1.19 kristaps 825: default:
826: break;
827: }
1.1 kristaps 828: }
829:
830: static int
831: pre_SH(DECL_ARGS)
832: {
1.134 schwarze 833: int i;
1.22 kristaps 834:
1.19 kristaps 835: switch (n->type) {
1.146 schwarze 836: case MAN_BLOCK:
1.113 kristaps 837: mt->fl &= ~MANT_LITERAL;
1.122 schwarze 838: mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
839: mt->offset = term_len(p, p->defindent);
1.22 kristaps 840: /* If following a prior empty `SH', no vspace. */
1.19 kristaps 841: if (n->prev && MAN_SH == n->prev->tok)
842: if (NULL == n->prev->body->child)
843: break;
1.61 kristaps 844: /* If the first macro, no vspae. */
845: if (NULL == n->prev)
846: break;
1.134 schwarze 847: for (i = 0; i < mt->pardist; i++)
848: term_vspace(p);
1.19 kristaps 849: break;
1.146 schwarze 850: case MAN_HEAD:
1.52 kristaps 851: term_fontrepl(p, TERMFONT_BOLD);
1.19 kristaps 852: p->offset = 0;
853: break;
1.146 schwarze 854: case MAN_BODY:
1.26 kristaps 855: p->offset = mt->offset;
1.19 kristaps 856: break;
857: default:
858: break;
859: }
1.1 kristaps 860:
861: return(1);
862: }
863:
864: static void
865: post_SH(DECL_ARGS)
866: {
1.146 schwarze 867:
1.19 kristaps 868: switch (n->type) {
1.146 schwarze 869: case MAN_HEAD:
1.19 kristaps 870: term_newln(p);
871: break;
1.146 schwarze 872: case MAN_BODY:
1.19 kristaps 873: term_newln(p);
874: break;
875: default:
876: break;
877: }
1.1 kristaps 878: }
879:
1.26 kristaps 880: static int
881: pre_RS(DECL_ARGS)
882: {
1.110 kristaps 883: int ival;
884: size_t sz;
1.26 kristaps 885:
886: switch (n->type) {
1.146 schwarze 887: case MAN_BLOCK:
1.26 kristaps 888: term_newln(p);
889: return(1);
1.146 schwarze 890: case MAN_HEAD:
1.26 kristaps 891: return(0);
892: default:
893: break;
894: }
895:
1.122 schwarze 896: sz = term_len(p, p->defindent);
1.26 kristaps 897:
1.110 kristaps 898: if (NULL != (n = n->parent->head->child))
1.146 schwarze 899: if ((ival = a2width(p, n->string)) >= 0)
1.110 kristaps 900: sz = (size_t)ival;
1.26 kristaps 901:
1.110 kristaps 902: mt->offset += sz;
1.140 schwarze 903: p->offset = mt->offset;
904: p->rmargin = p->maxrmargin > p->offset ?
1.146 schwarze 905: p->maxrmargin : p->offset;
1.26 kristaps 906:
1.116 schwarze 907: if (++mt->lmarginsz < MAXMARGINS)
908: mt->lmargincur = mt->lmarginsz;
909:
910: mt->lmargin[mt->lmargincur] = mt->lmargin[mt->lmargincur - 1];
1.26 kristaps 911: return(1);
912: }
913:
914: static void
915: post_RS(DECL_ARGS)
916: {
1.110 kristaps 917: int ival;
918: size_t sz;
1.26 kristaps 919:
920: switch (n->type) {
1.146 schwarze 921: case MAN_BLOCK:
1.110 kristaps 922: return;
1.146 schwarze 923: case MAN_HEAD:
1.110 kristaps 924: return;
1.26 kristaps 925: default:
926: term_newln(p);
927: break;
928: }
1.110 kristaps 929:
1.122 schwarze 930: sz = term_len(p, p->defindent);
1.110 kristaps 931:
1.146 schwarze 932: if (NULL != (n = n->parent->head->child))
933: if ((ival = a2width(p, n->string)) >= 0)
1.110 kristaps 934: sz = (size_t)ival;
935:
936: mt->offset = mt->offset < sz ? 0 : mt->offset - sz;
937: p->offset = mt->offset;
1.116 schwarze 938:
939: if (--mt->lmarginsz < MAXMARGINS)
940: mt->lmargincur = mt->lmarginsz;
1.137 schwarze 941: }
942:
943: static int
944: pre_UR(DECL_ARGS)
945: {
946:
947: return (MAN_HEAD != n->type);
948: }
949:
950: static void
951: post_UR(DECL_ARGS)
952: {
953:
954: if (MAN_BLOCK != n->type)
955: return;
956:
957: term_word(p, "<");
958: p->flags |= TERMP_NOSPACE;
959:
960: if (NULL != n->child->child)
961: print_man_node(p, mt, n->child->child, meta);
962:
963: p->flags |= TERMP_NOSPACE;
964: term_word(p, ">");
1.26 kristaps 965: }
966:
1.1 kristaps 967: static void
1.45 kristaps 968: print_man_node(DECL_ARGS)
1.1 kristaps 969: {
1.65 joerg 970: size_t rm, rmax;
1.54 kristaps 971: int c;
1.1 kristaps 972:
973: switch (n->type) {
1.146 schwarze 974: case MAN_TEXT:
1.97 kristaps 975: /*
976: * If we have a blank line, output a vertical space.
977: * If we have a space as the first character, break
978: * before printing the line's data.
979: */
1.96 kristaps 980: if ('\0' == *n->string) {
1.4 kristaps 981: term_vspace(p);
1.98 schwarze 982: return;
1.97 kristaps 983: } else if (' ' == *n->string && MAN_LINE & n->flags)
1.96 kristaps 984: term_newln(p);
1.54 kristaps 985:
1.4 kristaps 986: term_word(p, n->string);
1.130 schwarze 987: goto out;
1.52 kristaps 988:
1.146 schwarze 989: case MAN_EQN:
1.152 ! schwarze 990: if ( ! (n->flags & MAN_LINE))
! 991: p->flags |= TERMP_NOSPACE;
1.115 kristaps 992: term_eqn(p, n->eqn);
1.97 kristaps 993: return;
1.146 schwarze 994: case MAN_TBL:
1.97 kristaps 995: /*
996: * Tables are preceded by a newline. Then process a
997: * table line, which will cause line termination,
998: */
1.146 schwarze 999: if (TBL_SPAN_FIRST & n->span->flags)
1.93 kristaps 1000: term_newln(p);
1.92 kristaps 1001: term_tbl(p, n->span);
1.97 kristaps 1002: return;
1.1 kristaps 1003: default:
1004: break;
1005: }
1006:
1.97 kristaps 1007: if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
1008: term_fontrepl(p, TERMFONT_NONE);
1009:
1010: c = 1;
1011: if (termacts[n->tok].pre)
1.135 schwarze 1012: c = (*termacts[n->tok].pre)(p, mt, n, meta);
1.97 kristaps 1013:
1.1 kristaps 1014: if (c && n->child)
1.135 schwarze 1015: print_man_nodelist(p, mt, n->child, meta);
1.1 kristaps 1016:
1.97 kristaps 1017: if (termacts[n->tok].post)
1.135 schwarze 1018: (*termacts[n->tok].post)(p, mt, n, meta);
1.97 kristaps 1019: if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
1020: term_fontrepl(p, TERMFONT_NONE);
1.63 kristaps 1021:
1.130 schwarze 1022: out:
1023: /*
1024: * If we're in a literal context, make sure that words
1025: * together on the same line stay together. This is a
1026: * POST-printing call, so we check the NEXT word. Since
1027: * -man doesn't have nested macros, we don't need to be
1028: * more specific than this.
1029: */
1030: if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) &&
1.142 schwarze 1031: (NULL == n->next || MAN_LINE & n->next->flags)) {
1.130 schwarze 1032: rm = p->rmargin;
1033: rmax = p->maxrmargin;
1034: p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
1035: p->flags |= TERMP_NOSPACE;
1036: if (NULL != n->string && '\0' != *n->string)
1037: term_flushln(p);
1038: else
1039: term_newln(p);
1040: if (rm < rmax && n->parent->tok == MAN_HP) {
1041: p->offset = rm;
1042: p->rmargin = rmax;
1043: } else
1044: p->rmargin = rm;
1045: p->maxrmargin = rmax;
1046: }
1.63 kristaps 1047: if (MAN_EOS & n->flags)
1048: p->flags |= TERMP_SENTENCE;
1.1 kristaps 1049: }
1050:
1051:
1052: static void
1.52 kristaps 1053: print_man_nodelist(DECL_ARGS)
1.1 kristaps 1054: {
1.19 kristaps 1055:
1.135 schwarze 1056: print_man_node(p, mt, n, meta);
1.1 kristaps 1057: if ( ! n->next)
1058: return;
1.135 schwarze 1059: print_man_nodelist(p, mt, n->next, meta);
1.1 kristaps 1060: }
1061:
1.31 kristaps 1062: static void
1.73 kristaps 1063: print_man_foot(struct termp *p, const void *arg)
1.1 kristaps 1064: {
1.147 schwarze 1065: const struct man_meta *meta;
1066: char *title;
1067: size_t datelen;
1.73 kristaps 1068:
1069: meta = (const struct man_meta *)arg;
1.125 schwarze 1070: assert(meta->title);
1071: assert(meta->msec);
1072: assert(meta->date);
1.1 kristaps 1073:
1.52 kristaps 1074: term_fontrepl(p, TERMFONT_NONE);
1.50 kristaps 1075:
1.149 schwarze 1076: if (meta->hasbody)
1077: term_vspace(p);
1.126 schwarze 1078:
1079: /*
1080: * Temporary, undocumented option to imitate mdoc(7) output.
1081: * In the bottom right corner, use the source instead of
1082: * the title.
1083: */
1084:
1085: if ( ! p->mdocstyle) {
1.149 schwarze 1086: if (meta->hasbody) {
1087: term_vspace(p);
1088: term_vspace(p);
1089: }
1.147 schwarze 1090: mandoc_asprintf(&title, "%s(%s)",
1091: meta->title, meta->msec);
1.126 schwarze 1092: } else if (meta->source) {
1.147 schwarze 1093: title = mandoc_strdup(meta->source);
1.126 schwarze 1094: } else {
1.147 schwarze 1095: title = mandoc_strdup("");
1.126 schwarze 1096: }
1.125 schwarze 1097: datelen = term_strlen(p, meta->date);
1.1 kristaps 1098:
1.126 schwarze 1099: /* Bottom left corner: manual source. */
1100:
1.1 kristaps 1101: p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
1.139 schwarze 1102: p->trailspace = 1;
1.1 kristaps 1103: p->offset = 0;
1.123 schwarze 1104: p->rmargin = (p->maxrmargin - datelen + term_len(p, 1)) / 2;
1.1 kristaps 1105:
1106: if (meta->source)
1107: term_word(p, meta->source);
1108: term_flushln(p);
1109:
1.126 schwarze 1110: /* At the bottom in the middle: manual date. */
1111:
1.117 schwarze 1112: p->flags |= TERMP_NOSPACE;
1.1 kristaps 1113: p->offset = p->rmargin;
1.123 schwarze 1114: p->rmargin = p->maxrmargin - term_strlen(p, title);
1115: if (p->offset + datelen >= p->rmargin)
1116: p->rmargin = p->offset + datelen;
1117:
1.125 schwarze 1118: term_word(p, meta->date);
1.123 schwarze 1119: term_flushln(p);
1120:
1.126 schwarze 1121: /* Bottom right corner: manual title and section. */
1122:
1.123 schwarze 1123: p->flags &= ~TERMP_NOBREAK;
1124: p->flags |= TERMP_NOSPACE;
1.139 schwarze 1125: p->trailspace = 0;
1.123 schwarze 1126: p->offset = p->rmargin;
1.1 kristaps 1127: p->rmargin = p->maxrmargin;
1128:
1.123 schwarze 1129: term_word(p, title);
1.1 kristaps 1130: term_flushln(p);
1.147 schwarze 1131: free(title);
1.1 kristaps 1132: }
1133:
1.31 kristaps 1134: static void
1.73 kristaps 1135: print_man_head(struct termp *p, const void *arg)
1.1 kristaps 1136: {
1.147 schwarze 1137: const struct man_meta *meta;
1.148 schwarze 1138: const char *volume;
1.147 schwarze 1139: char *title;
1.148 schwarze 1140: size_t vollen, titlen;
1.73 kristaps 1141:
1.135 schwarze 1142: meta = (const struct man_meta *)arg;
1143: assert(meta->title);
1144: assert(meta->msec);
1.1 kristaps 1145:
1.148 schwarze 1146: volume = NULL == meta->vol ? "" : meta->vol;
1147: vollen = term_strlen(p, volume);
1.1 kristaps 1148:
1.126 schwarze 1149: /* Top left corner: manual title and section. */
1150:
1.147 schwarze 1151: mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
1.77 kristaps 1152: titlen = term_strlen(p, title);
1.1 kristaps 1153:
1.118 schwarze 1154: p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
1.139 schwarze 1155: p->trailspace = 1;
1.1 kristaps 1156: p->offset = 0;
1.148 schwarze 1157: p->rmargin = 2 * (titlen+1) + vollen < p->maxrmargin ?
1158: (p->maxrmargin - vollen + term_len(p, 1)) / 2 :
1159: p->maxrmargin - vollen;
1.1 kristaps 1160:
1161: term_word(p, title);
1162: term_flushln(p);
1163:
1.126 schwarze 1164: /* At the top in the middle: manual volume. */
1165:
1.117 schwarze 1166: p->flags |= TERMP_NOSPACE;
1.1 kristaps 1167: p->offset = p->rmargin;
1.148 schwarze 1168: p->rmargin = p->offset + vollen + titlen < p->maxrmargin ?
1.57 kristaps 1169: p->maxrmargin - titlen : p->maxrmargin;
1.1 kristaps 1170:
1.148 schwarze 1171: term_word(p, volume);
1.1 kristaps 1172: term_flushln(p);
1173:
1.126 schwarze 1174: /* Top right corner: title and section, again. */
1175:
1.1 kristaps 1176: p->flags &= ~TERMP_NOBREAK;
1.139 schwarze 1177: p->trailspace = 0;
1.57 kristaps 1178: if (p->rmargin + titlen <= p->maxrmargin) {
1.117 schwarze 1179: p->flags |= TERMP_NOSPACE;
1.57 kristaps 1180: p->offset = p->rmargin;
1181: p->rmargin = p->maxrmargin;
1182: term_word(p, title);
1183: term_flushln(p);
1184: }
1.1 kristaps 1185:
1.118 schwarze 1186: p->flags &= ~TERMP_NOSPACE;
1187: p->offset = 0;
1.1 kristaps 1188: p->rmargin = p->maxrmargin;
1.61 kristaps 1189:
1.146 schwarze 1190: /*
1.126 schwarze 1191: * Groff prints three blank lines before the content.
1192: * Do the same, except in the temporary, undocumented
1193: * mode imitating mdoc(7) output.
1.62 kristaps 1194: */
1195:
1.61 kristaps 1196: term_vspace(p);
1.126 schwarze 1197: if ( ! p->mdocstyle) {
1198: term_vspace(p);
1199: term_vspace(p);
1200: }
1.147 schwarze 1201: free(title);
1.1 kristaps 1202: }
CVSweb