xref: /haiku/src/system/libroot/posix/locale/nl_langinfo.cpp (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 /*
2  * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <langinfo.h>
8 
9 #include "LocaleBackend.h"
10 
11 #include <PosixLanginfo.h>
12 
13 
14 using BPrivate::Libroot::gLocaleBackend;
15 using BPrivate::Libroot::gPosixLanginfo;
16 
17 
18 extern "C" char*
19 nl_langinfo(nl_item item)
20 {
21 	if (item < 0 || item >= _NL_LANGINFO_LAST)
22 		return const_cast<char*>("");
23 
24 	if (gLocaleBackend != NULL)
25 		return const_cast<char*>(gLocaleBackend->GetLanginfo(item));
26 
27 	return const_cast<char*>(gPosixLanginfo[item]);
28 }
29