=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.391 retrieving revision 1.392 diff -u -p -r1.391 -r1.392 --- mandoc/mdoc_validate.c 2022/06/08 16:31:46 1.391 +++ mandoc/mdoc_validate.c 2025/06/05 12:33:41 1.392 @@ -1,6 +1,6 @@ -/* $Id: mdoc_validate.c,v 1.391 2022/06/08 16:31:46 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.392 2025/06/05 12:33:41 schwarze Exp $ */ /* - * Copyright (c) 2010-2021 Ingo Schwarze + * Copyright (c) 2010-2022, 2025 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010 Joerg Sonnenberger * @@ -991,18 +991,39 @@ post_ex(POST_ARGS) static void post_lb(POST_ARGS) { - struct roff_node *n; - const char *p; + struct roff_node *n, *nch; + const char *ccp; + char *cp; post_delim_nb(mdoc); n = mdoc->last; - assert(n->child->type == ROFFT_TEXT); + nch = n->child; + assert(nch->type == ROFFT_TEXT); mdoc->next = ROFF_NEXT_CHILD; - if ((p = mdoc_a2lib(n->child->string)) != NULL) { + if (n->sec == SEC_SYNOPSIS) { + roff_word_alloc(mdoc, n->line, n->pos, "/*"); + mdoc->last->flags = NODE_NOSRC; + while (nch != NULL) { + roff_word_alloc(mdoc, n->line, n->pos, "-l"); + mdoc->last->flags = NODE_DELIMO | NODE_NOSRC; + mdoc->last = nch; + assert(nch->type == ROFFT_TEXT); + cp = nch->string; + if (strncmp(cp, "lib", 3) == 0) + memmove(cp, cp + 3, strlen(cp) - 3 + 1); + nch = nch->next; + } + roff_word_alloc(mdoc, n->line, n->pos, "*/"); + mdoc->last->flags = NODE_NOSRC; + mdoc->last = n; + return; + } + + if ((ccp = mdoc_a2lib(n->child->string)) != NULL) { n->child->flags |= NODE_NOPRT; - roff_word_alloc(mdoc, n->line, n->pos, p); + roff_word_alloc(mdoc, n->line, n->pos, ccp); mdoc->last->flags = NODE_NOSRC; mdoc->last = n; return;