comparison dcclib/strlcat.c @ 0:c7f6b056b673

First import of vendor version
author Peter Gervai <grin@grin.hu>
date Tue, 10 Mar 2009 13:49:58 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c7f6b056b673
1 /* compatibility hack */
2
3 #include "dcc_defs.h"
4
5 int
6 dcc_strlcat(char *dst, const char *src, int lim)
7 {
8 int dlen, slen, delta;
9
10 dlen = strlen(dst);
11 delta = lim - dlen;
12 if (delta <= 0)
13 return lim;
14
15 slen = strlen(src);
16 if (slen >= delta)
17 slen = delta-1;
18 if (slen <= 0)
19 return dlen;
20 memcpy(dst+dlen, src, slen);
21 dlen += slen;
22 dst[dlen] = '\0';
23 return dlen;
24 }