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. Modified: trunk/reactos/subsys/system/cmd/misc.c Modified: trunk/reactos/subsys/system/cmd/prompt.c _____
Modified: trunk/reactos/subsys/system/cmd/misc.c --- trunk/reactos/subsys/system/cmd/misc.c 2005-09-03 19:44:47 UTC (rev 17624) +++ trunk/reactos/subsys/system/cmd/misc.c 2005-09-03 19:59:51 UTC (rev 17625) @@ -381,10 +381,10 @@
while ((--nBufferLength > 0) && ReadFile(hFile, &ch, 1, &dwRead, NULL) && dwRead) { - if (ch == '\r') + if ((ch == '\n') || (ch == '\r')) { - /* overread '\n' */ - ReadFile (hFile, &ch, 1, &dwRead, NULL); + /* read it*/ + lpString[len++] = ch; break; } lpString[len++] = ch; _____
Modified: trunk/reactos/subsys/system/cmd/prompt.c --- trunk/reactos/subsys/system/cmd/prompt.c 2005-09-03 19:44:47 UTC (rev 17624) +++ trunk/reactos/subsys/system/cmd/prompt.c 2005-09-03 19:59:51 UTC (rev 17625) @@ -192,8 +192,7 @@
#ifdef INCLUDE_CMD_PROMPT
INT cmd_prompt (LPTSTR cmd, LPTSTR param) -{ - LPTSTR szParam; +{ if (!_tcsncmp (param, _T("/?"), 2)) { ConOutResPaging(TRUE,STRING_PROMPT_HELP1); @@ -210,15 +209,24 @@ so even if param is null you _must_ still set prompt to the default. There seems to be some kinda difference 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 + and will later change to dymatic buffer */ + + /* set PROMPT environment variable */ if (param[0] != _T('\0')) - _tcscpy(szParam,param); + { + if (!SetEnvironmentVariable (_T("PROMPT"), param)) + return 1; + } else + { + TCHAR szParam[5]; _tcscpy(szParam,_T("$P$G")); + if (!SetEnvironmentVariable (_T("PROMPT"),szParam)) + return 1; + }
- /* set PROMPT environment variable */ - if (!SetEnvironmentVariable (_T("PROMPT"), szParam)) - return 1; + return 0; }