xref: /haiku/src/system/libroot/posix/string/strcoll.cpp (revision ae9019359606f1db67632ef51a77ce70001d3770)
1a3f66598SOliver Tappe /*
2a3f66598SOliver Tappe  * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3a3f66598SOliver Tappe  * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
4a3f66598SOliver Tappe  * All rights reserved. Distributed under the terms of the MIT License.
5a3f66598SOliver Tappe  */
6a3f66598SOliver Tappe 
7a3f66598SOliver Tappe #include <errno.h>
8a3f66598SOliver Tappe #include <string.h>
9a3f66598SOliver Tappe 
10*ae901935SOliver Tappe #include <errno_private.h>
11a3f66598SOliver Tappe #include "LocaleBackend.h"
12a3f66598SOliver Tappe 
13a3f66598SOliver Tappe 
1425dc253dSIngo Weinhold using BPrivate::Libroot::gLocaleBackend;
15a3f66598SOliver Tappe 
16a3f66598SOliver Tappe 
17a3f66598SOliver Tappe extern "C" int
18a3f66598SOliver Tappe strcoll(const char *a, const char *b)
19a3f66598SOliver Tappe {
20a3f66598SOliver Tappe 	if (gLocaleBackend != NULL) {
21a3f66598SOliver Tappe 		int result = 0;
22a3f66598SOliver Tappe 		status_t status = gLocaleBackend->Strcoll(a, b, result);
23a3f66598SOliver Tappe 
24a3f66598SOliver Tappe 		if (status != B_OK)
25*ae901935SOliver Tappe 			__set_errno(EINVAL);
26a3f66598SOliver Tappe 
27a3f66598SOliver Tappe 		return result;
28a3f66598SOliver Tappe 	}
29a3f66598SOliver Tappe 
30a3f66598SOliver Tappe 	return strcmp(a, b);
31a3f66598SOliver Tappe }
32