summaryrefslogtreecommitdiff
path: root/src/commonlib/bsd/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib/bsd/string.c')
-rw-r--r--src/commonlib/bsd/string.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/commonlib/bsd/string.c b/src/commonlib/bsd/string.c
index a9dce39e8d..16cd4b5e1d 100644
--- a/src/commonlib/bsd/string.c
+++ b/src/commonlib/bsd/string.c
@@ -23,6 +23,29 @@ size_t strnlen(const char *str, size_t maxlen)
return ptr - str - 1;
}
+char *strcat(char *dst, const char *src)
+{
+ char *ptr = dst + strlen(dst);
+
+ while (*src)
+ *ptr++ = *src++;
+
+ *ptr = '\0';
+ return dst;
+}
+
+char *strncat(char *dst, const char *src, size_t n)
+{
+ char *ptr = dst + strlen(dst);
+
+ /* Not using strncpy() because '\0' may not be appended. */
+ while (n-- > 0 && *src)
+ *ptr++ = *src++;
+
+ *ptr = '\0';
+ return dst;
+}
+
unsigned int skip_atoi(char **ptr)
{
unsigned int result = 0;