Subversion Repositories Tewi

Rev

Rev 6 | Rev 20 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 16
Line 1... Line 1...
1
/* $Id: string.c 6 2024-09-13 10:28:20Z nishi $ */
1
/* $Id: string.c 16 2024-09-13 15:09:52Z nishi $ */
2
 
2
 
3
#include <string.h>
3
#include <string.h>
4
#include <stdlib.h>
4
#include <stdlib.h>
5
#include <stdbool.h>
5
#include <stdbool.h>
6
#include <ctype.h>
6
#include <ctype.h>
Line 11... Line 11...
11
	memcpy(str + strlen(a), b, strlen(b));
11
	memcpy(str + strlen(a), b, strlen(b));
12
	str[strlen(a) + strlen(b)] = 0;
12
	str[strlen(a) + strlen(b)] = 0;
13
	return str;
13
	return str;
14
}
14
}
15
 
15
 
-
 
16
char* cm_strcat3(const char* a, const char* b, const char* c) {
-
 
17
	char* tmp = cm_strcat(a, b);
-
 
18
	char* str = cm_strcat(tmp, c);
-
 
19
	free(tmp);
-
 
20
	return str;
-
 
21
}
-
 
22
 
16
char* cm_strdup(const char* str) { return cm_strcat(str, ""); }
23
char* cm_strdup(const char* str) { return cm_strcat(str, ""); }
17
 
24
 
18
char* cm_trimstart(const char* str) {
25
char* cm_trimstart(const char* str) {
19
	int i;
26
	int i;
20
	for(i = 0; str[i] != 0; i++) {
27
	for(i = 0; str[i] != 0; i++) {