diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-17 16:15:27 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-17 16:15:27 +0000 |
commit | c6e35c35ae3f9fc589c153d500eb8d77813f2780 (patch) | |
tree | a2b2dda54e095730873ac80a13f367899739038b /xstd.c | |
parent | 56f0b4a0fb2fb74f3bf1c6f8ed87ce2b716bcf52 (diff) | |
download | mandoc-c6e35c35ae3f9fc589c153d500eb8d77813f2780.tar.gz |
Documentation, more validations, cleaned up actions, added Nm action.
Diffstat (limited to 'xstd.c')
-rw-r--r-- | xstd.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -16,6 +16,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ +#include <assert.h> #include <err.h> #include <stdlib.h> #include <string.h> @@ -75,6 +76,30 @@ 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: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ |