Mercurial > notdcc
annotate dcclib/strlcat.c @ 5:0a7a5940ee3a
Change description per license
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 15:03:24 +0100 |
parents | c7f6b056b673 |
children |
rev | line source |
---|---|
0 | 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 } |