summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReini Urban <rurban@x-ray.at>2012-02-08 17:58:21 -0600
committerTony Cook <tony@develop-help.com>2012-02-09 12:52:12 +1100
commit286f819461ff93f6b56f8f7d1b5689a84b32896f (patch)
tree225b8a69b6b692291e4ebf5f03f682f145be7d5a
parent5bc802de7e259c78b42107eb3d64a617e13556f9 (diff)
downloadperl-286f819461ff93f6b56f8f7d1b5689a84b32896f.tar.gz
add Cygwin::sync_winenv [perl #110190]
Cygwin::sync_winenv should fix [CPAN #65052], ADODB missing %COMMONPROGRAMFILES%. sync_winenv code and solution by Chris Day.
-rw-r--r--README.cygwin11
-rw-r--r--cygwin/cygwin.c3
2 files changed, 14 insertions, 0 deletions
diff --git a/README.cygwin b/README.cygwin
index 017c452277..4e3e6f57ff 100644
--- a/README.cygwin
+++ b/README.cygwin
@@ -513,6 +513,17 @@ User mounts override system mounts.
Returns true if the given cygwin path is binary mounted, false if the
path is mounted in textmode.
+=item C<Cygwin::sync_winenv>
+
+Cygwin does not initialize all original Win32 environment variables.
+See the bottom of this page L<http://cygwin.com/cygwin-ug-net/setup-env.html>
+for "Restricted Win32 environment".
+
+Certain Win32 programs called from cygwin programs might need some environment
+variable, such as e.g. ADODB needs %COMMONPROGRAMFILES%.
+Call Cygwin::sync_winenv() to copy all Win32 environment variables to your
+process and note that cygwin will warn on every encounter of non-POSIX paths.
+
=back
=head1 INSTALL PERL ON CYGWIN
diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c
index 0f5fe1d7fc..9419e83aa7 100644
--- a/cygwin/cygwin.c
+++ b/cygwin/cygwin.c
@@ -538,6 +538,8 @@ XS(XS_Cygwin_is_binmount)
XSRETURN(1);
}
+XS(XS_Cygwin_sync_winenv){ cygwin_internal(CW_SYNC_WINENV); }
+
void
init_os_extras(void)
{
@@ -553,6 +555,7 @@ init_os_extras(void)
newXSproto("Cygwin::mount_table", XS_Cygwin_mount_table, file, "");
newXSproto("Cygwin::mount_flags", XS_Cygwin_mount_flags, file, "$");
newXSproto("Cygwin::is_binmount", XS_Cygwin_is_binmount, file, "$");
+ newXS("Cygwin::sync_winenv", XS_Cygwin_sync_winenv, file);
/* Initialize Win32CORE if it has been statically linked. */
handle = dlopen(NULL, RTLD_LAZY);