MCPcopy Index your code
hub / github.com/F-Stack/f-stack / strlcat

Function strlcat

tools/compat/strlcat.c:40–69  ·  view source on GitHub ↗

* Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NUL terminates (unless siz <= strlen(dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */

(dst, src, siz)

Source from the content-addressed store, hash-verified

38 * If retval >= siz, truncation occurred.
39 */
40size_t
41strlcat(dst, src, siz)
42 char *dst;
43 const char *src;
44 size_t siz;
45{
46 char *d = dst;
47 const char *s = src;
48 size_t n = siz;
49 size_t dlen;
50
51 /* Find the end of dst and adjust bytes left but don't go past end */
52 while (n-- != 0 && *d != '\0')
53 d++;
54 dlen = d - dst;
55 n = siz - dlen;
56
57 if (n == 0)
58 return(dlen + strlen(s));
59 while (*s != '\0') {
60 if (n != 1) {
61 *d++ = *s;
62 n--;
63 }
64 s++;
65 }
66 *d = '\0';
67
68 return(dlen + (s - src)); /* count does not include NUL */
69}

Callers 15

str_flagsFunction · 0.50
netname6Function · 0.50
usageFunction · 0.50
mainFunction · 0.50
ifmaybeloadFunction · 0.50
get_chaninfoFunction · 0.50
mainFunction · 0.50
print_flowset_parmsFunction · 0.50
output_jsonFunction · 0.50
sff_show_asciiFunction · 0.50
sff_8024_show_identifierFunction · 0.50

Calls

no outgoing calls

Tested by 5

str_flagsFunction · 0.40
mainFunction · 0.40
test_rte_strlcatFunction · 0.40
commands_initFunction · 0.40