From d346448c959f7b9855c02917b358cfb0da2525e8 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Tue, 3 Jan 2012 15:16:24 +0000 Subject: Add support for `OP', one of the extended man macros. This also requires some man(7) changes to accomodate for the an-ext compatibility. --- man_term.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'man_term.c') diff --git a/man_term.c b/man_term.c index 180fc677..69c5c95e 100644 --- a/man_term.c +++ b/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.126 2011/12/04 23:10:52 schwarze Exp $ */ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -68,21 +68,22 @@ static void print_man_foot(struct termp *, const void *); static void print_bvspace(struct termp *, const struct man_node *); -static int pre_alternate(DECL_ARGS); static int pre_B(DECL_ARGS); static int pre_HP(DECL_ARGS); static int pre_I(DECL_ARGS); static int pre_IP(DECL_ARGS); +static int pre_OP(DECL_ARGS); static int pre_PP(DECL_ARGS); static int pre_RS(DECL_ARGS); static int pre_SH(DECL_ARGS); static int pre_SS(DECL_ARGS); static int pre_TP(DECL_ARGS); +static int pre_alternate(DECL_ARGS); +static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); static int pre_in(DECL_ARGS); static int pre_literal(DECL_ARGS); static int pre_sp(DECL_ARGS); -static int pre_ft(DECL_ARGS); static void post_IP(DECL_ARGS); static void post_HP(DECL_ARGS); @@ -125,6 +126,7 @@ static const struct termact termacts[MAN_MAX] = { { pre_ign, NULL, 0 }, /* AT */ { pre_in, NULL, MAN_NOTEXT }, /* in */ { pre_ft, NULL, MAN_NOTEXT }, /* ft */ + { pre_OP, NULL, 0 }, /* OP */ }; @@ -322,6 +324,29 @@ pre_B(DECL_ARGS) return(1); } +/* ARGSUSED */ +static int +pre_OP(DECL_ARGS) +{ + + term_word(p, "["); + p->flags |= TERMP_NOSPACE; + + if (NULL != (n = n->child)) { + term_fontrepl(p, TERMFONT_BOLD); + term_word(p, n->string); + } + if (NULL != n && NULL != n->next) { + term_fontrepl(p, TERMFONT_UNDER); + term_word(p, n->next->string); + } + + term_fontrepl(p, TERMFONT_NONE); + p->flags |= TERMP_NOSPACE; + term_word(p, "]"); + return(0); +} + /* ARGSUSED */ static int pre_ft(DECL_ARGS) -- cgit v1.2.3