=================================================================== RCS file: /cvs/mandoc/mdoc_man.c,v retrieving revision 1.62 retrieving revision 1.64 diff -u -p -r1.62 -r1.64 --- mandoc/mdoc_man.c 2014/04/20 16:46:05 1.62 +++ mandoc/mdoc_man.c 2014/07/02 03:48:07 1.64 @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.62 2014/04/20 16:46:05 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.64 2014/07/02 03:48:07 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze * @@ -51,6 +51,7 @@ static void post_bf(DECL_ARGS); static void post_bk(DECL_ARGS); static void post_bl(DECL_ARGS); static void post_dl(DECL_ARGS); +static void post_en(DECL_ARGS); static void post_enc(DECL_ARGS); static void post_eo(DECL_ARGS); static void post_fa(DECL_ARGS); @@ -78,8 +79,10 @@ static int pre_bl(DECL_ARGS); static int pre_br(DECL_ARGS); static int pre_bx(DECL_ARGS); static int pre_dl(DECL_ARGS); +static int pre_en(DECL_ARGS); static int pre_enc(DECL_ARGS); static int pre_em(DECL_ARGS); +static int pre_es(DECL_ARGS); static int pre_fa(DECL_ARGS); static int pre_fd(DECL_ARGS); static int pre_fl(DECL_ARGS); @@ -150,7 +153,7 @@ static const struct manact manacts[MDOC_MAX + 1] = { { cond_head, pre_enc, NULL, "\\- ", NULL }, /* Nd */ { NULL, pre_nm, post_nm, NULL, NULL }, /* Nm */ { cond_body, pre_enc, post_enc, "[", "]" }, /* Op */ - { NULL, NULL, NULL, NULL, NULL }, /* Ot */ + { NULL, pre_ft, post_font, NULL, NULL }, /* Ot */ { NULL, pre_em, post_font, NULL, NULL }, /* Pa */ { NULL, pre_enc, post_enc, "The \\fB", "\\fP\nfunction returns the value 0 if successful;\n" @@ -224,7 +227,7 @@ static const struct manact manacts[MDOC_MAX + 1] = { { NULL, NULL, NULL, NULL, NULL }, /* Ek */ { NULL, pre_ux, NULL, "is currently in beta test.", NULL }, /* Bt */ { NULL, NULL, NULL, NULL, NULL }, /* Hf */ - { NULL, NULL, NULL, NULL, NULL }, /* Fr */ + { NULL, pre_em, post_font, NULL, NULL }, /* Fr */ { NULL, pre_ux, NULL, "currently under development.", NULL }, /* Ud */ { NULL, NULL, post_lb, NULL, NULL }, /* Lb */ { NULL, pre_pp, NULL, NULL, NULL }, /* Lp */ @@ -234,8 +237,8 @@ static const struct manact manacts[MDOC_MAX + 1] = { { cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */ { NULL, NULL, NULL, NULL, NULL }, /* Brc */ { NULL, NULL, post_percent, NULL, NULL }, /* %C */ - { NULL, NULL, NULL, NULL, NULL }, /* Es */ - { NULL, NULL, NULL, NULL, NULL }, /* En */ + { NULL, pre_es, NULL, NULL, NULL }, /* Es */ + { cond_body, pre_en, post_en, NULL, NULL }, /* En */ { NULL, pre_ux, NULL, "DragonFly", NULL }, /* Dx */ { NULL, NULL, post_percent, NULL, NULL }, /* %Q */ { NULL, pre_br, NULL, NULL, NULL }, /* br */ @@ -457,7 +460,7 @@ print_offs(const char *v) if (Bl_stack_len) sz += Bl_stack[Bl_stack_len - 1]; - snprintf(buf, sizeof(buf), "%zun", sz); + (void)snprintf(buf, sizeof(buf), "%zun", sz); print_word(buf); outflags |= MMAN_nl; } @@ -510,7 +513,7 @@ print_width(const char *v, const struct mdoc_node *chi remain = sz + 2; } if (numeric) { - snprintf(buf, sizeof(buf), "%zun", sz + 2); + (void)snprintf(buf, sizeof(buf), "%zun", sz + 2); print_word(buf); } else print_word(v); @@ -520,9 +523,9 @@ print_width(const char *v, const struct mdoc_node *chi static void print_count(int *count) { - char buf[12]; + char buf[24]; - snprintf(buf, sizeof(buf), "%d.", ++*count); + (void)snprintf(buf, sizeof(buf), "%d.", ++*count); print_word(buf); } @@ -1035,7 +1038,34 @@ pre_em(DECL_ARGS) return(1); } +static int +pre_en(DECL_ARGS) +{ + + if (NULL == n->norm->Es || + NULL == n->norm->Es->child) + return(1); + + print_word(n->norm->Es->child->string); + outflags &= ~MMAN_spc; + return(1); +} + static void +post_en(DECL_ARGS) +{ + + if (NULL == n->norm->Es || + NULL == n->norm->Es->child || + NULL == n->norm->Es->child->next) + return; + + outflags &= ~MMAN_spc; + print_word(n->norm->Es->child->next->string); + return; +} + +static void post_eo(DECL_ARGS) { @@ -1044,6 +1074,13 @@ post_eo(DECL_ARGS) } static int +pre_es(DECL_ARGS) +{ + + return(0); +} + +static int pre_fa(DECL_ARGS) { int am_Fa; @@ -1316,7 +1353,8 @@ mid_it(void) /* Restore the indentation of the enclosing list. */ print_line(".RS", MMAN_Bk_susp); - snprintf(buf, sizeof(buf), "%zun", Bl_stack[Bl_stack_len - 1]); + (void)snprintf(buf, sizeof(buf), "%zun", + Bl_stack[Bl_stack_len - 1]); print_word(buf); /* Remeber to close out this .RS block later. */