This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
warnings.pl: Silence perl compiler warnings
[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   CODE:
22 #ifdef HAS_NL_LANGINFO
23         {
24           char *s;
25
26           if ((s = nl_langinfo(code)))
27               RETVAL = newSVpvn(s, strlen(s));
28           else
29               RETVAL = &PL_sv_undef;
30         }
31 #else
32         croak("nl_langinfo() not implemented on this architecture");
33 #endif
34   OUTPUT:
35         RETVAL