- for (i = 0; i < (int)ssz; i++) {
- if (pos >= (int)ln->sz) {
- ln->sz += 256; /* Step-size. */
- ln->buf = realloc(ln->buf, ln->sz);
- if (NULL == ln->buf)
- err(1, "realloc");
- }
-
- if ('\n' != blk->buf[i]) {
- /*
- * Ugly of uglies. Here we handle the
- * dreaded `Xo/Xc' scoping. Cover the
- * eyes of any nearby children. This
- * makes `Xo/Xc' enclosures look like
- * one huge line.
- */
-#ifdef STRIP_XO
- /*
- * First, note whether we're in a macro
- * line.
- */
- if (0 == pos && '.' == blk->buf[i])
- macro = 1;
-
- /*
- * If we're in an `Xo' context and just
- * nixed a newline, remove the control
- * character for new macro lines:
- * they're going to show up as all part
- * of the same line.
- */
- if (xo && xeoln && '.' == blk->buf[i]) {
- xeoln = 0;
- continue;
- }
- xeoln = 0;
-
- /*
- * If we've parsed `Xo', enter an xo
- * context. `Xo' must be in a parsable
- * state. This is the ugly part. IT IS
- * NOT SMART ENOUGH TO HANDLE ESCAPED
- * WHITESPACE.
- */
- if (macro && pos && 'o' == blk->buf[i]) {
- if (xo && 'X' == ln->buf[pos - 1]) {
- if (' ' == ln->buf[pos - 2])
- xo++;
- } else if ('X' == ln->buf[pos - 1]) {
- if (2 == pos && '.' == ln->buf[pos - 2])
- xo++;
- else if (' ' == ln->buf[pos - 2])
- xo++;
- }
- }
-
- /*
- * If we're parsed `Xc', leave an xo
- * context if one's already pending.
- * `Xc' must be in a parsable state.
- * THIS IS NOT SMART ENOUGH TO HANDLE
- * ESCAPED WHITESPACE.
- */
- if (macro && pos && 'c' == blk->buf[i])
- if (xo && 'X' == ln->buf[pos - 1])
- if (' ' == ln->buf[pos - 2])
- xo--;
-#endif /* STRIP_XO */
-
- ln->buf[pos++] = blk->buf[i];
- continue;
- }
+ switch (curp->outtype) {
+ case OUTT_HTML:
+ /* FALLTHROUGH */
+ case OUTT_XHTML:
+ curp->outman = html_man;
+ curp->outmdoc = html_mdoc;
+ break;
+ case OUTT_TREE:
+ curp->outman = tree_man;
+ curp->outmdoc = tree_mdoc;
+ break;
+ case OUTT_MAN:
+ curp->outmdoc = man_mdoc;
+ curp->outman = man_man;
+ break;
+ case OUTT_PDF:
+ /* FALLTHROUGH */
+ case OUTT_ASCII:
+ /* FALLTHROUGH */
+ case OUTT_UTF8:
+ /* FALLTHROUGH */
+ case OUTT_LOCALE:
+ /* FALLTHROUGH */
+ case OUTT_PS:
+ curp->outman = terminal_man;
+ curp->outmdoc = terminal_mdoc;
+ break;
+ default:
+ break;
+ }
+ }