Subversion Repositories IRC-Archiver

Rev

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

Rev Author Line No. Line
3 nishi 1
/* $Id: util.c 11 2024-08-30 05:20:32Z nishi $ */
2
 
3
#include "ia_util.h"
4
 
5
#include <stdlib.h>
6
#include <string.h>
7
 
8
char* ia_strcat(const char* a, const char* b) {
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
 
11 nishi 16
char* ia_strcat3(const char* a, const char* b, const char* c) {
17
	char* tmp = ia_strcat(a, b);
18
	char* str = ia_strcat(tmp, c);
19
	free(tmp);
20
	return str;
21
}
22
 
23
char* ia_strcat4(const char* a, const char* b, const char* c, const char* d) {
24
	char* tmp = ia_strcat3(a, b, c);
25
	char* str = ia_strcat(tmp, d);
26
	free(tmp);
27
	return str;
28
}
29
 
3 nishi 30
char* ia_strdup(const char* str) { return ia_strcat(str, ""); }