diff options
Diffstat (limited to 'src/common/stringx.c')
-rw-r--r-- | src/common/stringx.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/stringx.c b/src/common/stringx.c index 06e4879..89deb9b 100644 --- a/src/common/stringx.c +++ b/src/common/stringx.c @@ -108,3 +108,17 @@ int strtob(const char* str) return -1; } + +size_t +strlcpy(char *dst, const char *src, size_t len) +{ + size_t ret = strlen(dst); + + while (len > 1) { + *dst++ = *src++; + len--; + } + if (len > 0) + *dst = '\0'; + return (ret); +} |