summaryrefslogtreecommitdiff
path: root/ext/I18N-Langinfo/Langinfo.xs
blob: 663cb2a66574cd6bbc9e821d68a69db80d01385b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#define PERL_NO_GET_CONTEXT

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#ifdef I_LANGINFO
#   define __USE_GNU 1 /* Enables YESSTR, otherwise only __YESSTR. */
#   include <langinfo.h>
#else
#   include <perl_langinfo.h>
#endif

#include "const-c.inc"

MODULE = I18N::Langinfo	PACKAGE = I18N::Langinfo

PROTOTYPES: ENABLE

INCLUDE: const-xs.inc

SV*
langinfo(code)
	int	code
  PROTOTYPE: _
  CODE:
#ifdef HAS_NL_LANGINFO
	if (code < 0) {
	    SETERRNO(EINVAL, LIB_INVARG);
	    RETVAL = &PL_sv_undef;
	} else {
            RETVAL = newSVpv(Perl_langinfo(code), 0);
        }
#else
        RETVAL = newSVpv(Perl_langinfo(code), 0);
#endif
  OUTPUT:
	RETVAL