version 1.148, 2014/04/23 16:08:33 |
version 1.155, 2014/10/28 17:36:19 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
#ifdef HAVE_CONFIG_H |
|
#include "config.h" |
#include "config.h" |
#endif |
|
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
|
|
terminal_man(void *arg, const struct man *man) |
terminal_man(void *arg, const struct man *man) |
{ |
{ |
struct termp *p; |
struct termp *p; |
const struct man_node *n; |
|
const struct man_meta *meta; |
const struct man_meta *meta; |
|
struct man_node *n; |
struct mtermp mt; |
struct mtermp mt; |
|
|
p = (struct termp *)arg; |
p = (struct termp *)arg; |
|
|
if (0 == p->defindent) |
|
p->defindent = 7; |
|
|
|
p->overstep = 0; |
p->overstep = 0; |
p->maxrmargin = p->defrmargin; |
p->rmargin = p->maxrmargin = p->defrmargin; |
p->tabwidth = term_len(p, 5); |
p->tabwidth = term_len(p, 5); |
|
|
if (NULL == p->symtab) |
n = man_node(man)->child; |
p->symtab = mchars_alloc(); |
|
|
|
n = man_node(man); |
|
meta = man_meta(man); |
meta = man_meta(man); |
|
|
term_begin(p, print_man_head, print_man_foot, meta); |
|
p->flags |= TERMP_NOSPACE; |
|
|
|
memset(&mt, 0, sizeof(struct mtermp)); |
memset(&mt, 0, sizeof(struct mtermp)); |
|
|
mt.lmargin[mt.lmargincur] = term_len(p, p->defindent); |
mt.lmargin[mt.lmargincur] = term_len(p, p->defindent); |
mt.offset = term_len(p, p->defindent); |
mt.offset = term_len(p, p->defindent); |
mt.pardist = 1; |
mt.pardist = 1; |
|
|
if (n->child) |
if (p->synopsisonly) { |
print_man_nodelist(p, &mt, n->child, meta); |
while (n != NULL) { |
|
if (n->tok == MAN_SH && |
term_end(p); |
n->child->child->type == MAN_TEXT && |
|
!strcmp(n->child->child->string, "SYNOPSIS")) { |
|
if (n->child->next->child != NULL) |
|
print_man_nodelist(p, &mt, |
|
n->child->next->child, meta); |
|
term_newln(p); |
|
break; |
|
} |
|
n = n->next; |
|
} |
|
} else { |
|
if (p->defindent == 0) |
|
p->defindent = 7; |
|
term_begin(p, print_man_head, print_man_foot, meta); |
|
p->flags |= TERMP_NOSPACE; |
|
if (n != NULL) |
|
print_man_nodelist(p, &mt, n, meta); |
|
term_end(p); |
|
} |
} |
} |
|
|
|
|
Line 977 print_man_node(DECL_ARGS) |
|
Line 984 print_man_node(DECL_ARGS) |
|
goto out; |
goto out; |
|
|
case MAN_EQN: |
case MAN_EQN: |
|
if ( ! (n->flags & MAN_LINE)) |
|
p->flags |= TERMP_NOSPACE; |
term_eqn(p, n->eqn); |
term_eqn(p, n->eqn); |
|
if (n->next != NULL && ! (n->next->flags & MAN_LINE)) |
|
p->flags |= TERMP_NOSPACE; |
return; |
return; |
case MAN_TBL: |
case MAN_TBL: |
/* |
/* |
Line 1061 print_man_foot(struct termp *p, const void *arg) |
|
Line 1072 print_man_foot(struct termp *p, const void *arg) |
|
|
|
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
|
term_vspace(p); |
if (meta->hasbody) |
|
term_vspace(p); |
|
|
/* |
/* |
* Temporary, undocumented option to imitate mdoc(7) output. |
* Temporary, undocumented option to imitate mdoc(7) output. |
Line 1070 print_man_foot(struct termp *p, const void *arg) |
|
Line 1082 print_man_foot(struct termp *p, const void *arg) |
|
*/ |
*/ |
|
|
if ( ! p->mdocstyle) { |
if ( ! p->mdocstyle) { |
term_vspace(p); |
if (meta->hasbody) { |
term_vspace(p); |
term_vspace(p); |
|
term_vspace(p); |
|
} |
mandoc_asprintf(&title, "%s(%s)", |
mandoc_asprintf(&title, "%s(%s)", |
meta->title, meta->msec); |
meta->title, meta->msec); |
} else if (meta->source) { |
} else if (meta->source) { |