summaryrefslogtreecommitdiffstats
path: root/mandoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mandoc.c b/mandoc.c
index 6d11e9b7..0f8e5394 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -432,6 +432,16 @@ mandoc_realloc(void *ptr, size_t size)
return(ptr);
}
+char *
+mandoc_strndup(const char *ptr, size_t sz)
+{
+ char *p;
+
+ p = mandoc_malloc(sz + 1);
+ memcpy(p, ptr, sz);
+ p[(int)sz] = '\0';
+ return(p);
+}
char *
mandoc_strdup(const char *ptr)