summaryrefslogtreecommitdiff
path: root/cygwin/cygwin.c
blob: bece81b1e4a265280629b64bf6954672fa1ba47d (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
/*
 * Cygwin extras
 */

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

#include <unistd.h>


/* see also Cwd.pm */
static
XS(Cygwin_cwd)
{
    dXSARGS;
    char *cwd;

    if(items != 0)
	Perl_croak(aTHX_ "Usage: Cwd::cwd()");
    if(cwd = getcwd(NULL, 0)) {
	ST(0) = sv_2mortal(newSVpv(cwd, 0));
	safesysfree(cwd);
	XSRETURN(1);
    }
    XSRETURN_UNDEF;
}

void
init_os_extras(void)
{
    char *file = __FILE__;
    dTHX;

    newXS("Cwd::cwd", Cygwin_cwd, file);
}