xref: /haiku/src/system/libroot/posix/wchar/wcscoll.cpp (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
5 
6 #include <errno_private.h>
7 #include <LocaleBackend.h>
8 #include <wchar_private.h>
9 
10 
11 using BPrivate::Libroot::gLocaleBackend;
12 
13 
14 extern "C" int
15 __wcscoll(const wchar_t* wcs1, const wchar_t* wcs2)
16 {
17 	if (gLocaleBackend != NULL) {
18 		int result = 0;
19 		status_t status = gLocaleBackend->Wcscoll(wcs1, wcs2, result);
20 
21 		if (status != B_OK)
22 			__set_errno(EINVAL);
23 
24 		return result;
25 	}
26 
27 	return wcscmp(wcs1, wcs2);
28 }
29 
30 
31 extern "C"
32 B_DEFINE_WEAK_ALIAS(__wcscoll, wcscoll);
33