* environ.cc (regopt): Remove function.

(environ_init): Drop undocumented feature to read application-specific
	environment variables from the registry.
	* include/cygwin/version.h (CYGWIN_INFO_PROGRAM_OPTIONS_NAME): Remove.
This commit is contained in:
Corinna Vinschen 2014-12-08 11:21:14 +00:00
parent ca1cabfe21
commit e20a68a56f
3 changed files with 9 additions and 44 deletions

View File

@ -1,3 +1,10 @@
2014-12-08 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (regopt): Remove function.
(environ_init): Drop undocumented feature to read application-specific
environment variables from the registry.
* include/cygwin/version.h (CYGWIN_INFO_PROGRAM_OPTIONS_NAME): Remove.
2014-12-05 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (build_env): Remove loquacious debug statements.

View File

@ -788,39 +788,8 @@ ucenv (char *p, const char *eq)
}
}
/* Set options from the registry. */
static bool __stdcall
regopt (PCWSTR name, char *buf)
{
bool parsed_something = false;
UNICODE_STRING lname;
size_t len = (wcslen(name) + 1) * sizeof (WCHAR);
WCHAR lbuf[1024]; /* Use reasonable size to lower stack pressure.
get_string alloca's this additionally and 1024
is more than enough for CYGWIN env var values. */
RtlInitEmptyUnicodeString(&lname, (PWCHAR) alloca (len), len);
wcscpy(lname.Buffer, name);
RtlDowncaseUnicodeString(&lname, &lname, FALSE);
for (int i = 0; i < 2; i++)
{
reg_key r (i, KEY_READ, _WIDE (CYGWIN_INFO_PROGRAM_OPTIONS_NAME), NULL);
if (NT_SUCCESS (r.get_string (lname.Buffer, lbuf, 1024, L"")))
{
sys_wcstombs (buf, NT_MAX_PATH, lbuf);
parse_options (buf);
parsed_something = true;
break;
}
}
MALLOC_CHECK;
return parsed_something;
}
/* Initialize the environ array. Look for the CYGWIN environment
environment variable and set appropriate options from it. */
/* Initialize the environ array. Look for the CYGWIN environment variable and
set appropriate options from it. */
void
environ_init (char **envp, int envc)
{
@ -830,18 +799,12 @@ environ_init (char **envp, int envc)
char *newp;
int sawTERM = 0;
bool envp_passed_in;
bool got_something_from_registry;
static char NO_COPY cygterm[] = "TERM=cygwin";
tmp_pathbuf tp;
__try
{
char *tmpbuf = tp.t_get ();
got_something_from_registry = regopt (L"default", tmpbuf);
if (myself->progname[0])
got_something_from_registry = regopt (myself->progname, tmpbuf)
|| got_something_from_registry;
if (!envp)
envp_passed_in = 0;
else
@ -915,10 +878,6 @@ environ_init (char **envp, int envc)
if (p)
parse_options (p);
}
if (got_something_from_registry)
parse_options (NULL); /* possibly export registry settings to
environment */
MALLOC_CHECK;
}
__except (NO_ERROR)

View File

@ -497,7 +497,6 @@ details. */
/* Identifiers used in the Win32 registry. */
#define CYGWIN_INFO_CYGWIN_REGISTRY_NAME "Cygwin"
#define CYGWIN_INFO_PROGRAM_OPTIONS_NAME "Program Options"
#define CYGWIN_INFO_INSTALLATIONS_NAME "Installations"
/* The default cygdrive prefix. */