Subversion Repositories Keine

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 nishi 1
/* $Id: util.c 4 2024-09-11 10:22:22Z nishi $ */
2
 
3
#include "kn_util.h"
4
 
5
#include <string.h>
6
#include <stdlib.h>
7
 
4 nishi 8
char* kn_strcat(const char* a, const char* b) {
2 nishi 9
	char* str = malloc(strlen(a) + strlen(b) + 1);
10
	memcpy(str, a, strlen(a));
11
	memcpy(str + strlen(a), b, strlen(b));
12
	str[strlen(a) + strlen(b)] = 0;
13
	return str;
14
}
15
 
4 nishi 16
char* kn_strcat3(const char* a, const char* b, const char* c) {
17
	char* tmp = kn_strcat(a, b);
18
	char* str = kn_strcat(tmp, c);
19
	free(tmp);
20
	return str;
2 nishi 21
}
4 nishi 22
 
23
char* kn_strdup(const char* a) { return kn_strcat(a, ""); }