Mercurial > notdcc
annotate dcclib/strlcat.c @ 4:d329bb5c36d0
Changes making it compile the new upstream release
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 14:57:12 +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 } |