diff options
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c index ece410b2c..fbcf3d9dd 100644 --- a/src/utils.c +++ b/src/utils.c @@ -70,4 +70,22 @@ int ipv6Supported() { return 0; } -/* vim:set shiftwidth=4 tabstop=8 expandtab: */ +char * appendToString(char * dest, const char * src) { + int destlen; + int srclen = strlen(src); + + if(dest == NULL) { + dest = malloc(srclen+1); + memset(dest, 0, srclen+1); + destlen = 0; + } + else { + destlen = strlen(dest); + dest = realloc(dest, destlen+srclen+1); + } + + memcpy(dest+destlen, src, srclen); + dest[destlen+srclen] = '\0'; + + return dest; +} |