maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_strlcat.c File Reference
#include "libft.h"
Include dependency graph for ft_strlcat.c:

Go to the source code of this file.

Functions

size_t ft_strlcat (char *dst, const char *src, size_t size)
 

Function Documentation

◆ ft_strlcat()

size_t ft_strlcat ( char *  dst,
const char *  src,
size_t  size 
)

Definition at line 26 of file ft_strlcat.c.

27{
28 char *d;
29 const char *s;
30 size_t len_dst;
31 size_t remaining_space;
32
33 len_dst = 0;
34 s = src;
35 d = dst;
36 while (size > 0 && *d != '\0')
37 {
38 d++;
39 size--;
40 len_dst++;
41 }
42 remaining_space = size;
43 if (remaining_space == 0)
44 return (len_dst + ft_strlen(src));
45 while (--remaining_space > 0 && *s != '\0')
46 *d++ = *s++;
47 *d = '\0';
48 return (len_dst + ft_strlen(src));
49}
size_t ft_strlen(const char *s)
Definition ft_strlen.c:15

References ft_strlen().

Here is the call graph for this function: