summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/cygwin/cygwin.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-06 16:11:09 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-06 16:11:09 +0000
commite852ed17d905386f3bbad057fda2f07926227f89 (patch)
tree9c602984a369e27373c3cd3b71bd8c8e791393f2 /gnu/usr.bin/perl/cygwin/cygwin.c
parent9cfdf10e50d1f9e72606c75c7b7a0e18940c80aa (diff)
virgin perl 5.6.0
Diffstat (limited to 'gnu/usr.bin/perl/cygwin/cygwin.c')
-rw-r--r--gnu/usr.bin/perl/cygwin/cygwin.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/cygwin/cygwin.c b/gnu/usr.bin/perl/cygwin/cygwin.c
new file mode 100644
index 00000000000..bece81b1e4a
--- /dev/null
+++ b/gnu/usr.bin/perl/cygwin/cygwin.c
@@ -0,0 +1,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);
+}