revers brandon change to prompt.c they are incorrect. Add a check if prompt env are set or not. if it is not set cmd set the prompt value. in cmd.c brandon forget that.

svn path=/trunk/; revision=17614
This commit is contained in:
Magnus Olsen 2005-09-03 09:46:46 +00:00
parent 35240bd337
commit 5d08c58541
2 changed files with 14 additions and 10 deletions

View file

@ -1311,6 +1311,7 @@ Initialize (int argc, TCHAR* argv[])
TCHAR commandline[CMDLINE_LENGTH];
TCHAR ModuleName[_MAX_PATH + 1];
INT i;
TCHAR lpBuffer[2];
//INT len;
//TCHAR *ptr, *cmdLine;
@ -1358,7 +1359,12 @@ Initialize (int argc, TCHAR* argv[])
hOut = GetStdHandle (STD_OUTPUT_HANDLE);
hIn = GetStdHandle (STD_INPUT_HANDLE);
SetEnvironmentVariable (_T("PROMPT"), _T("$P$G"));
/* Set EnvironmentVariable PROMPT if it does not exists any env value.
for you can change the EnvirommentVariable for prompt before cmd start
this patch are not 100% right, if it does not exists a PROMPT value cmd should use
$P$G as defualt not set EnvirommentVariable PROMPT to $P$G if it does not exists */
if (GetEnvironmentVariable(_T("PROMPT"),lpBuffer, 2 * sizeof(TCHAR)) == 0)
SetEnvironmentVariable (_T("PROMPT"), _T("$P$G"));
if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2))

View file

@ -192,8 +192,7 @@ VOID PrintPrompt(VOID)
#ifdef INCLUDE_CMD_PROMPT
INT cmd_prompt (LPTSTR cmd, LPTSTR param)
{
TCHAR szParam[512];
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
@ -204,15 +203,14 @@ INT cmd_prompt (LPTSTR cmd, LPTSTR param)
ConOutResPaging(FALSE,STRING_PROMPT_HELP3);
return 0;
}
if (param[0] != _T('\0'))
_tcscpy(szParam,param);
else
_tcscpy(szParam,_T("$P$G"));
/* set PROMPT environment variable */
if (!SetEnvironmentVariable (_T("PROMPT"), szParam))
return 1;
if (param[0] != _T('\0'))
{
if (!SetEnvironmentVariable (_T("PROMPT"), param))
return 1;
}
return 0;
}
#endif