=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.129 retrieving revision 1.130 diff -c -r1.129 -r1.130 *** src/usr.bin/mandoc/mdoc_validate.c 2014/04/20 19:39:35 1.129 --- src/usr.bin/mandoc/mdoc_validate.c 2014/04/20 20:48:34 1.130 *************** *** 1,4 **** ! /* $Id: mdoc_validate.c,v 1.129 2014/04/20 19:39:35 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze --- 1,4 ---- ! /* $Id: mdoc_validate.c,v 1.130 2014/04/20 20:48:34 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze *************** *** 1040,1073 **** static int post_lb(POST_ARGS) { ! const char *p; ! char *buf; ! size_t sz; check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1); ! assert(mdoc->last->child); ! assert(MDOC_TEXT == mdoc->last->child->type); ! p = mdoc_a2lib(mdoc->last->child->string); ! /* If lookup ok, replace with table value. */ ! if (p) { ! free(mdoc->last->child->string); ! mdoc->last->child->string = mandoc_strdup(p); ! return(1); ! } ! ! /* If not, use "library ``xxxx''. */ ! ! sz = strlen(mdoc->last->child->string) + 2 + ! strlen("\\(lqlibrary\\(rq"); ! buf = mandoc_malloc(sz); ! snprintf(buf, sz, "library \\(lq%s\\(rq", ! mdoc->last->child->string); ! free(mdoc->last->child->string); ! mdoc->last->child->string = buf; return(1); } --- 1040,1064 ---- static int post_lb(POST_ARGS) { ! struct mdoc_node *n; ! const char *stdlibname; ! char *libname; check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1); ! n = mdoc->last->child; ! assert(n); ! assert(MDOC_TEXT == n->type); ! if (NULL == (stdlibname = mdoc_a2lib(n->string))) ! mandoc_asprintf(&libname, ! "library \\(lq%s\\(rq", n->string); ! else ! libname = mandoc_strdup(stdlibname); ! free(n->string); ! n->string = libname; return(1); }