This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Actually make I18N::Langinfo avail on all platforms
[perl5.git] / ext / I18N-Langinfo / Langinfo.xs
1 #define PERL_NO_GET_CONTEXT
2
3 #include "EXTERN.h"
4 #include "perl.h"
5 #include "XSUB.h"
6
7 #ifdef I_LANGINFO
8 #   define __USE_GNU 1 /* Enables YESSTR, otherwise only __YESSTR. */
9 #   include <langinfo.h>
10 #else
11 #   include <perl_langinfo.h>
12 #endif
13
14 #include "const-c.inc"
15
16 MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo
17
18 PROTOTYPES: ENABLE
19
20 INCLUDE: const-xs.inc
21
22 SV*
23 langinfo(code)
24         int     code
25   PROTOTYPE: _
26   CODE:
27 #ifdef HAS_NL_LANGINFO
28         if (code < 0) {
29             SETERRNO(EINVAL, LIB_INVARG);
30             RETVAL = &PL_sv_undef;
31         } else {
32             RETVAL = newSVpv(Perl_langinfo(code), 0);
33         }
34 #else
35         RETVAL = newSVpv(Perl_langinfo(code), 0);
36 #endif
37   OUTPUT:
38         RETVAL