Have a little faith on nl_langinfo() itself.
[p5sagit/p5-mst-13.2.git] / ext / I18N / Langinfo / Langinfo.xs
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 #ifdef I_LANGINFO
6 #   include <langinfo.h>
7 #endif
8
9 #include "constants.c"
10
11 MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo
12
13 PROTOTYPES: ENABLE
14
15 INCLUDE: constants.xs
16
17 SV*
18 langinfo(code)
19         int     code
20   CODE:
21 #ifdef HAS_NL_LANGINFO
22         {
23           char *s;
24
25           if ((s = nl_langinfo(code)))
26               RETVAL = newSVpvn(s, strlen(s));
27           else
28               RETVAL = &PL_sv_undef;
29         }
30 #else
31         croak("nl_langinfo() not implemented on this architecture");
32 #endif
33   OUTPUT:
34         RETVAL