1/*
2 * Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de.
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
5
6#include <errno.h>
7
8#include <errno_private.h>
9#include <LocaleBackend.h>
10#include <wchar_private.h>
11
12
13using BPrivate::Libroot::gLocaleBackend;
14
15
16extern "C" size_t
17__wcsxfrm(wchar_t* dest, const wchar_t* src, size_t destSize)
18{
19	if (gLocaleBackend != NULL) {
20		size_t outSize = 0;
21		status_t status = gLocaleBackend->Wcsxfrm(dest, src, destSize, outSize);
22
23		if (status != B_OK)
24			__set_errno(EINVAL);
25
26		return outSize;
27	}
28
29	return wcslcpy(dest, src, destSize);
30}
31
32
33extern "C"
34B_DEFINE_WEAK_ALIAS(__wcsxfrm, wcsxfrm);
35