Subversion Repositories IRCServ

Rev

Rev 5 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/* $Id: util.c 7 2024-08-25 20:49:55Z nishi $ */

#include "is_util.h"

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

char* is_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* is_strcat3(const char* a, const char* b, const char* c) {
        char* tmp = is_strcat(a, b);
        char* str = is_strcat(tmp, c);
        free(tmp);

        return str;
}

char* is_strdup(const char* str) { return is_strcat(str, ""); }