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
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 #ifdef I_LANGINFO
6 #   define __USE_GNU 1 /* Enables YESSTR, otherwise only __YESSTR. */
7 #   include <langinfo.h>
8 #endif
9
10 #include "const-c.inc"
11
12 MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo
13
14 PROTOTYPES: ENABLE
15
16 INCLUDE: const-xs.inc
17
18 SV*
19 langinfo(code)
20         int     code
21   PROTOTYPE: _
22   CODE:
23 #ifdef HAS_NL_LANGINFO
24         RETVAL = newSVpv(nl_langinfo(code), 0);
25 #else
26         croak("nl_langinfo() not implemented on this architecture");
27 #endif
28   OUTPUT:
29         RETVAL