Root/
Source at commit 1146 created 12 years 11 months ago. By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing). | |
---|---|
1 | /*␊ |
2 | * strlcat.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include <string.h>␊ |
6 | ␊ |
7 | size_t strlcat(char *dst, const char *src, size_t size)␊ |
8 | {␊ |
9 | ␉size_t bytes = 0;␊ |
10 | ␉char *q = dst;␊ |
11 | ␉const char *p = src;␊ |
12 | ␉char ch;␊ |
13 | ␊ |
14 | ␉while (bytes < size && *q) {␊ |
15 | ␉␉q++;␊ |
16 | ␉␉bytes++;␊ |
17 | ␉}␊ |
18 | ␉if (bytes == size)␊ |
19 | ␉␉return (bytes + strlen(src));␊ |
20 | ␊ |
21 | ␉while ((ch = *p++)) {␊ |
22 | ␉␉if (bytes + 1 < size)␊ |
23 | ␉␉␉*q++ = ch;␊ |
24 | ␊ |
25 | ␉␉bytes++;␊ |
26 | ␉}␊ |
27 | ␊ |
28 | ␉*q = '\0';␊ |
29 | ␉return bytes;␊ |
30 | }␊ |
31 |