mirror of
https://github.com/reactos/reactos.git
synced 2024-09-04 09:39:07 +00:00
fix type can handler \n at text output thx ravelo for the small patch. see file misc.c. prompt.c fix the szParam so it have a buffer set. and do not use szParam for param, the param length can in future very big. when dymatic buffer be implement at command line.
svn path=/trunk/; revision=17625
This commit is contained in:
parent
040c539dd5
commit
ada0f8dfe8
|
@ -381,10 +381,10 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
|
||||||
while ((--nBufferLength > 0) &&
|
while ((--nBufferLength > 0) &&
|
||||||
ReadFile(hFile, &ch, 1, &dwRead, NULL) && dwRead)
|
ReadFile(hFile, &ch, 1, &dwRead, NULL) && dwRead)
|
||||||
{
|
{
|
||||||
if (ch == '\r')
|
if ((ch == '\n') || (ch == '\r'))
|
||||||
{
|
{
|
||||||
/* overread '\n' */
|
/* read it*/
|
||||||
ReadFile (hFile, &ch, 1, &dwRead, NULL);
|
lpString[len++] = ch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lpString[len++] = ch;
|
lpString[len++] = ch;
|
||||||
|
|
|
@ -192,8 +192,7 @@ VOID PrintPrompt(VOID)
|
||||||
#ifdef INCLUDE_CMD_PROMPT
|
#ifdef INCLUDE_CMD_PROMPT
|
||||||
|
|
||||||
INT cmd_prompt (LPTSTR cmd, LPTSTR param)
|
INT cmd_prompt (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
LPTSTR szParam;
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
|
ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
|
||||||
|
@ -210,15 +209,24 @@ INT cmd_prompt (LPTSTR cmd, LPTSTR param)
|
||||||
so even if param is null you _must_ still set prompt
|
so even if param is null you _must_ still set prompt
|
||||||
to the default. There seems to be some kinda difference
|
to the default. There seems to be some kinda difference
|
||||||
between winxp and 2k in this matter and this way will
|
between winxp and 2k in this matter and this way will
|
||||||
cover both. */
|
cover both. Do not use fixed size of szParam for param the buffer are 8192bytes
|
||||||
if (param[0] != _T('\0'))
|
and will later change to dymatic buffer */
|
||||||
_tcscpy(szParam,param);
|
|
||||||
else
|
|
||||||
_tcscpy(szParam,_T("$P$G"));
|
|
||||||
|
|
||||||
/* set PROMPT environment variable */
|
/* set PROMPT environment variable */
|
||||||
if (!SetEnvironmentVariable (_T("PROMPT"), szParam))
|
if (param[0] != _T('\0'))
|
||||||
|
{
|
||||||
|
if (!SetEnvironmentVariable (_T("PROMPT"), param))
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCHAR szParam[5];
|
||||||
|
_tcscpy(szParam,_T("$P$G"));
|
||||||
|
if (!SetEnvironmentVariable (_T("PROMPT"),szParam))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue