summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/uinfo.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-10-07 21:28:57 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-10-07 21:28:57 +0000
commit60cb120f3e5d1931fd7ac6a78e5404d2deacde0f (patch)
tree76414af271a408f0d1da61d2b146697a5adbe571 /winsup/cygwin/uinfo.cc
parent9286b55306bf5412d4587586bf8cb2f62bd482ec (diff)
downloadcygnal-60cb120f3e5d1931fd7ac6a78e5404d2deacde0f.tar.gz
cygnal-60cb120f3e5d1931fd7ac6a78e5404d2deacde0f.tar.bz2
cygnal-60cb120f3e5d1931fd7ac6a78e5404d2deacde0f.zip
* cygheap.h (class cygheap_user): Add psystemroot member and
env_systemroot method. * environ.cc (struct spenv): Add add_always member. (spenvs): Accomodate new add_always member. Add cygheap_user::env_systemroot method to SYSTEMROOT entry. (build_env): Check add_always member when adding missing environment variables from spenvs. * uinfo.cc (cygheap_user::env_systemroot): New method.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r--winsup/cygwin/uinfo.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 757ca2000..6fca2fde8 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -449,6 +449,28 @@ cygheap_user::env_name (const char *name, size_t namelen)
return pwinname;
}
+const char *
+cygheap_user::env_systemroot (const char *name, size_t namelen)
+{
+ if (!psystemroot)
+ {
+ int size = GetWindowsDirectory (NULL, 0);
+ if (size > 0)
+ {
+ psystemroot = (char *) cmalloc (HEAP_STR, ++size);
+ size = GetWindowsDirectory (psystemroot, size);
+ if (size <= 0)
+ {
+ cfree (psystemroot);
+ psystemroot = NULL;
+ }
+ }
+ if (size <= 0)
+ debug_printf ("GetWindowsDirectory(), %E");
+ }
+ return psystemroot;
+}
+
char *
pwdgrp::next_str (char c)
{