Hello Gareth, thanks for the patch! I have some comments inlined.
On 8/8/20 7:39 AM, Gareth Poole wrote:
Windows and DOS before it has always kept the drive letter in uppercase at the command line, regardless of what input it is given. Since paths are case-insensitive this should not affect path resolution, but it is more consistent with bothe behaviour of Windows, and the behaviour that Wine CMD already displays with directory names.
Signed-off-by: Gareth Poole girpoole@gmail.com
programs/cmd/wcmdmain.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 97cc607a64..5f5f65fe34 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -392,12 +392,20 @@ static void WCMD_show_prompt (BOOL newLine) { break; case 'N': status = GetCurrentDirectoryW(ARRAY_SIZE(curdir), curdir);
/* No need to worry about surrogates here, because all possible */
/* drive letters are in the BMP. */
if (IsCharAlphaW(curdir[0])) { /* Check if the path begins with a drive letter. */
This call is unnecessary; toupper() leaves other characters untouched.
curdir[0] = toupper(curdir[0]); /* Ensure that the drive letter is shown in uppercase. */
}
I think these comments are rather superfluous. The code explains as much.
if (status) { *q++ = curdir[0]; } break;
case 'P': status = GetCurrentDirectoryW(ARRAY_SIZE(curdir), curdir);
if (IsCharAlphaW(curdir[0])) {
curdir[0] = toupper(curdir[0]);
if (status) { lstrcatW (q, curdir); while (*q) q++;}
@@ -1383,7 +1391,9 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects, (!cmd[2] || cmd[2] == ' ' || cmd[2] == '\t')) { WCHAR envvar[5]; WCHAR dir[MAX_PATH];
/* Make sure that the working directory is set to the */
/* canonical uppercase version of the drive letter. */
Same here.
cmd[0] = toupper(cmd[0]); /* Ignore potential garbage on the same line */ cmd[2]=0x00;