=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.338 retrieving revision 1.339 diff -u -p -r1.338 -r1.339 --- mandoc/mdoc_term.c 2017/01/10 13:47:00 1.338 +++ mandoc/mdoc_term.c 2017/01/10 21:59:47 1.339 @@ -1,7 +1,7 @@ -/* $Id: mdoc_term.c,v 1.338 2017/01/10 13:47:00 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.339 2017/01/10 21:59:47 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010, 2012-2016 Ingo Schwarze + * Copyright (c) 2010, 2012-2017 Ingo Schwarze * Copyright (c) 2013 Franco Fichtner * * Permission to use, copy, modify, and distribute this software for any @@ -80,6 +80,7 @@ static void termp_pf_post(DECL_ARGS); static void termp_quote_post(DECL_ARGS); static void termp_sh_post(DECL_ARGS); static void termp_ss_post(DECL_ARGS); +static void termp_xx_post(DECL_ARGS); static int termp__a_pre(DECL_ARGS); static int termp__t_pre(DECL_ARGS); @@ -189,7 +190,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_bf_pre, NULL }, /* Bf */ { termp_quote_pre, termp_quote_post }, /* Bo */ { termp_quote_pre, termp_quote_post }, /* Bq */ - { termp_xx_pre, NULL }, /* Bsx */ + { termp_xx_pre, termp_xx_post }, /* Bsx */ { termp_bx_pre, NULL }, /* Bx */ { termp_skip_pre, NULL }, /* Db */ { NULL, NULL }, /* Dc */ @@ -199,12 +200,12 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, NULL }, /* Ef */ { termp_em_pre, NULL }, /* Em */ { termp_eo_pre, termp_eo_post }, /* Eo */ - { termp_xx_pre, NULL }, /* Fx */ + { termp_xx_pre, termp_xx_post }, /* Fx */ { termp_bold_pre, NULL }, /* Ms */ { termp_li_pre, NULL }, /* No */ { termp_ns_pre, NULL }, /* Ns */ - { termp_xx_pre, NULL }, /* Nx */ - { termp_xx_pre, NULL }, /* Ox */ + { termp_xx_pre, termp_xx_post }, /* Nx */ + { termp_xx_pre, termp_xx_post }, /* Ox */ { NULL, NULL }, /* Pc */ { NULL, termp_pf_post }, /* Pf */ { termp_quote_pre, termp_quote_post }, /* Po */ @@ -222,7 +223,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_under_pre, NULL }, /* Sx */ { termp_sy_pre, NULL }, /* Sy */ { NULL, NULL }, /* Tn */ - { termp_xx_pre, NULL }, /* Ux */ + { termp_xx_pre, termp_xx_post }, /* Ux */ { NULL, NULL }, /* Xc */ { NULL, NULL }, /* Xo */ { termp_fo_pre, termp_fo_post }, /* Fo */ @@ -245,7 +246,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, termp____post }, /* %C */ { termp_skip_pre, NULL }, /* Es */ { termp_quote_pre, termp_quote_post }, /* En */ - { termp_xx_pre, NULL }, /* Dx */ + { termp_xx_pre, termp_xx_post }, /* Dx */ { NULL, termp____post }, /* %Q */ { termp_sp_pre, NULL }, /* br */ { termp_sp_pre, NULL }, /* sp */ @@ -1677,41 +1678,16 @@ termp_bx_pre(DECL_ARGS) static int termp_xx_pre(DECL_ARGS) { - const char *pp; - int flags; + if ((n->aux = p->flags & TERMP_PREKEEP) == 0) + p->flags |= TERMP_PREKEEP; + return 1; +} - pp = NULL; - switch (n->tok) { - case MDOC_Bsx: - pp = "BSD/OS"; - break; - case MDOC_Dx: - pp = "DragonFly"; - break; - case MDOC_Fx: - pp = "FreeBSD"; - break; - case MDOC_Nx: - pp = "NetBSD"; - break; - case MDOC_Ox: - pp = "OpenBSD"; - break; - case MDOC_Ux: - pp = "UNIX"; - break; - default: - abort(); - } - - term_word(p, pp); - if (n->child) { - flags = p->flags; - p->flags |= TERMP_KEEP; - term_word(p, n->child->string); - p->flags = flags; - } - return 0; +static void +termp_xx_post(DECL_ARGS) +{ + if (n->aux == 0) + p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); } static void