aboutsummaryrefslogtreecommitdiffstats
path: root/memory/strlcat.c
blob: 3061500a8d818ae85a4d7181834b6bce090d88e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#include "memory.h"

size_t strlcat(char *destination, char const *source, size_t max_lenght)
{
	size_t destination_lenght = strnlen(destination, max_lenght);
	if (destination_lenght == max_lenght)
		return destination_lenght + strlen(source);
	return destination_lenght + strlcpy(destination + destination_lenght,
					    source,
					    max_lenght - destination_lenght);
}