1/*
2** Copyright 2002, Manuel J. Petit.
3** Copyright 2011, Oliver Tappe <zooey@hirschkafer.de>.
4** All rights reserved. Distributed under the terms of the NewOS License.
5*/
6
7#include <wchar_private.h>
8
9
10size_t
11__wcslcpy(wchar_t* dest, const wchar_t* source, size_t maxLength)
12{
13	size_t i;
14
15	if (maxLength == 0)
16		return __wcslen(source);
17
18	for (i = 0; i < maxLength - 1 && *source != L'\0'; ++i)
19		*dest++ = *source++;
20
21	*dest++ = 0;
22
23	return i + __wcslen(source);
24}
25
26
27B_DEFINE_WEAK_ALIAS(__wcslcpy, wcslcpy);
28