diff --git a/reactos/subsys/system/cmd/bugs.txt b/reactos/subsys/system/cmd/bugs.txt index da1a2d6c2e6..ee9de9e7f42 100644 --- a/reactos/subsys/system/cmd/bugs.txt +++ b/reactos/subsys/system/cmd/bugs.txt @@ -11,5 +11,12 @@ o command.com ignores control-c and control-break, which makes it difficult o "alias v = dir" doesn't work because of the spaces. +o Dymatic commandline buffer need to be implement, current set to 8192bytes + +o Batchfile read row size need to be implement as dymatic not set to 2000bytes + + + + **** Please report bugs to ekohl@rz-online.de! **** diff --git a/reactos/subsys/system/cmd/cmd.c b/reactos/subsys/system/cmd/cmd.c index e9e8c357713..32dcb6c86c1 100644 --- a/reactos/subsys/system/cmd/cmd.c +++ b/reactos/subsys/system/cmd/cmd.c @@ -1037,12 +1037,13 @@ static INT ProcessInput (BOOL bFlag) { TCHAR commandline[CMDLINE_LENGTH]; - TCHAR readline[CMDLINE_LENGTH]; + TCHAR *readline = NULL; LPTSTR tp = NULL; LPTSTR ip; LPTSTR cp; BOOL bEchoThisLine; - + + readline = malloc(CMDLINE_LENGTH * sizeof(TCHAR)); do { @@ -1052,7 +1053,7 @@ ProcessInput (BOOL bFlag) if (bFlag) return 0; - ReadCommand (readline, CMDLINE_LENGTH); + readline = ReadCommand (readline, CMDLINE_LENGTH); ip = readline; bEchoThisLine = FALSE; } diff --git a/reactos/subsys/system/cmd/cmd.h b/reactos/subsys/system/cmd/cmd.h index c3dea180ee1..19b5bb4b1eb 100644 --- a/reactos/subsys/system/cmd/cmd.h +++ b/reactos/subsys/system/cmd/cmd.h @@ -106,7 +106,7 @@ extern HANDLE CMD_ModuleHandle; /* Prototypes for CMDINPUT.C */ -VOID ReadCommand (LPTSTR, INT); +TCHAR * ReadCommand (LPTSTR, INT); /* Prototypes for CMDTABLE.C */ diff --git a/reactos/subsys/system/cmd/cmdinput.c b/reactos/subsys/system/cmd/cmdinput.c index d48a6b3b268..872c08b4c0f 100644 --- a/reactos/subsys/system/cmd/cmdinput.c +++ b/reactos/subsys/system/cmd/cmdinput.c @@ -124,7 +124,7 @@ ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy) /* read in a command line */ -VOID ReadCommand (LPTSTR str, INT maxlen) +TCHAR * ReadCommand (LPTSTR str, INT maxlen) { SHORT orgx; /* origin x/y */ SHORT orgy; @@ -508,10 +508,15 @@ VOID ReadCommand (LPTSTR str, INT maxlen) default: #ifdef _UNICODE ch = ir.Event.KeyEvent.uChar.UnicodeChar; - if ((ch >= 32 && ch <= 255) && (charcount != (maxlen - 2))) + charcount ++; + str = realloc(str, charcount); + + if ((ch >= 32 && ch <= 255)) #else - ch = ir.Event.KeyEvent.uChar.AsciiChar; - if ((UCHAR)ch >= 32 && (charcount != (maxlen - 2))) + ch = ir.Event.KeyEvent.uChar.AsciiChar; + str = realloc(str, 2 + current * sizeof(TCHAR)); + + if ((UCHAR)ch >= 32 ) #endif /* _UNICODE */ { /* insert character into string... */ @@ -520,6 +525,8 @@ VOID ReadCommand (LPTSTR str, INT maxlen) /* If this character insertion will cause screen scrolling, * adjust the saved origin of the command prompt. */ tempscreen = _tcslen(str + current) + curx; + str = realloc(str, tempscreen * sizeof(TCHAR)); + if ((tempscreen % maxx) == (maxx - 1) && (tempscreen / maxx) + cury == (maxy - 1)) { @@ -527,6 +534,8 @@ VOID ReadCommand (LPTSTR str, INT maxlen) cury--; } + + for (count = charcount; count > current; count--) str[count] = str[count - 1]; str[current++] = ch; @@ -570,4 +579,6 @@ VOID ReadCommand (LPTSTR str, INT maxlen) while (ir.Event.KeyEvent.wVirtualKeyCode != VK_RETURN); SetCursorType (bInsert, TRUE); + + return str; }