This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cygwin port
[perl5.git] / cygwin / cygwin.c
1 /*
2  * Cygwin extras
3  */
4
5 #include "EXTERN.h"
6 #include "perl.h"
7 #undef USE_DYNAMIC_LOADING
8 #include "XSUB.h"
9
10 #include <sys/unistd.h>
11
12
13 /* see also Cwd.pm */
14 static
15 XS(Cygwin_cwd)
16 {
17     dXSARGS;
18     char *cwd;
19
20     if(items != 0)
21         Perl_croak(aTHX_ "Usage: Cwd::cwd()");
22     if(cwd = getcwd(NULL, 0)) {
23         ST(0) = sv_2mortal(newSVpv(cwd, 0));
24         safesysfree(cwd);
25         XSRETURN(1);
26     }
27     XSRETURN_UNDEF;
28 }
29
30 void
31 init_os_extras(void)
32 {
33     char *file = __FILE__;
34     dTHX;
35
36     newXS("Cwd::cwd", Cygwin_cwd, file);
37 }