This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In I18N::Langinfo::langinfo(), use newSVpv(), as it will call strlen()
[perl5.git] / ext / I18N-Langinfo / Langinfo.xs
CommitLineData
4bbcc6e8
JH
1#include "EXTERN.h"
2#include "perl.h"
3#include "XSUB.h"
4
5#ifdef I_LANGINFO
f53b541b 6# define __USE_GNU 1 /* Enables YESSTR, otherwise only __YESSTR. */
4bbcc6e8
JH
7# include <langinfo.h>
8#endif
9
1cb0fb50 10#include "const-c.inc"
4bbcc6e8
JH
11
12MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo
13
14PROTOTYPES: ENABLE
15
1cb0fb50 16INCLUDE: const-xs.inc
4bbcc6e8
JH
17
18SV*
d16d4b10 19langinfo(code)
4bbcc6e8 20 int code
d16d4b10 21 PROTOTYPE: _
4bbcc6e8 22 CODE:
8b26484b 23#ifdef HAS_NL_LANGINFO
7e203150 24 RETVAL = newSVpv(nl_langinfo(code), 0);
8b26484b
JH
25#else
26 croak("nl_langinfo() not implemented on this architecture");
27#endif
4bbcc6e8
JH
28 OUTPUT:
29 RETVAL