Commit | Line | Data |
---|---|---|
4bbcc6e8 | 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 | 7 | # include <langinfo.h> |
8 | #endif | |
9 | ||
1cb0fb50 | 10 | #include "const-c.inc" |
4bbcc6e8 | 11 | |
12 | MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo | |
13 | ||
14 | PROTOTYPES: ENABLE | |
15 | ||
1cb0fb50 | 16 | INCLUDE: const-xs.inc |
4bbcc6e8 | 17 | |
18 | SV* | |
19 | langinfo(code) | |
20 | int code | |
21 | CODE: | |
8b26484b | 22 | #ifdef HAS_NL_LANGINFO |
e1faa3a0 | 23 | { |
24 | char *s; | |
25 | ||
26 | if ((s = nl_langinfo(code))) | |
27 | RETVAL = newSVpvn(s, strlen(s)); | |
28 | else | |
29 | RETVAL = &PL_sv_undef; | |
b27961e5 | 30 | } |
8b26484b | 31 | #else |
32 | croak("nl_langinfo() not implemented on this architecture"); | |
33 | #endif | |
4bbcc6e8 | 34 | OUTPUT: |
35 | RETVAL |