summaryrefslogtreecommitdiff
path: root/ext/I18N-Langinfo/Langinfo.xs
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-02-09 16:04:26 +0000
committerNicholas Clark <nick@ccl4.org>2009-02-09 16:04:26 +0000
commit2c864a0811fbe4cad763045a119f93a241340a2f (patch)
tree444288ee161b6be094a27f8e7814aead4717f12f /ext/I18N-Langinfo/Langinfo.xs
parent48e8cb2025d894f1e4dc03b4ff1e595d292761f3 (diff)
downloadperl-2c864a0811fbe4cad763045a119f93a241340a2f.tar.gz
Rename ext/I18N/Langinfo to ext/I18N-Langinfo
Diffstat (limited to 'ext/I18N-Langinfo/Langinfo.xs')
-rw-r--r--ext/I18N-Langinfo/Langinfo.xs35
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/I18N-Langinfo/Langinfo.xs b/ext/I18N-Langinfo/Langinfo.xs
new file mode 100644
index 0000000000..c1da9818c1
--- /dev/null
+++ b/ext/I18N-Langinfo/Langinfo.xs
@@ -0,0 +1,35 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifdef I_LANGINFO
+# define __USE_GNU 1 /* Enables YESSTR, otherwise only __YESSTR. */
+# include <langinfo.h>
+#endif
+
+#include "const-c.inc"
+
+MODULE = I18N::Langinfo PACKAGE = I18N::Langinfo
+
+PROTOTYPES: ENABLE
+
+INCLUDE: const-xs.inc
+
+SV*
+langinfo(code)
+ int code
+ CODE:
+#ifdef HAS_NL_LANGINFO
+ {
+ char *s;
+
+ if ((s = nl_langinfo(code)))
+ RETVAL = newSVpvn(s, strlen(s));
+ else
+ RETVAL = &PL_sv_undef;
+ }
+#else
+ croak("nl_langinfo() not implemented on this architecture");
+#endif
+ OUTPUT:
+ RETVAL