=================================================================== RCS file: /cvs/mandoc/Attic/xstd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- mandoc/Attic/xstd.c 2008/12/29 18:08:44 1.2 +++ mandoc/Attic/xstd.c 2009/01/17 16:15:27 1.3 @@ -1,4 +1,4 @@ -/* $Id: xstd.c,v 1.2 2008/12/29 18:08:44 kristaps Exp $ */ +/* $Id: xstd.c,v 1.3 2009/01/17 16:15:27 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -16,6 +16,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include #include @@ -75,8 +76,32 @@ xstrdup(const char *p) } +int +xstrlcats(char *buf, const struct mdoc_node *n, size_t sz) +{ + char *p; + + assert(sz > 0); + assert(buf); + *buf = 0; + + for ( ; n; n = n->next) { + assert(MDOC_TEXT == n->type); + p = n->data.text.string; + if ( ! xstrlcat(buf, p, sz)) + return(0); + if (n->next && ! xstrlcat(buf, " ", sz)) + return(0); + } + + return(1); +} + + + + #ifdef __linux__ -/* $OpenBSD: xstd.c,v 1.2 2008/12/29 18:08:44 kristaps Exp $ */ +/* $OpenBSD: xstd.c,v 1.3 2009/01/17 16:15:27 kristaps Exp $ */ /* * Copyright (c) 1998 Todd C. Miller