Subversion Repositories Tewi

Rev

Rev 2 | Rev 4 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/* $Id: string.c 3 2024-09-13 09:06:44Z nishi $ */

#include <string.h>
#include <stdlib.h>

char* cm_strcat(const char* a, const char* b) {
        char* str = malloc(strlen(a) + strlen(b) + 1);
        memcpy(str, a, strlen(a));
        memcpy(str + strlen(a), b, strlen(b));
        str[strlen(a) + strlen(b)] = 0;
        return str;
}

char* cm_strdup(const char* str) { return cm_strcat(str, ""); }