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