chcp: Set the global codepage when called with an argument.

Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Erich E. Hoover 2019-11-07 15:31:34 -07:00 committed by Alexandre Julliard
parent 658d2e6133
commit 329a1c247a
1 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "wine/debug.h"
#include "wincon.h"
#include "stdlib.h"
WINE_DEFAULT_DEBUG_CHANNEL(chcp);
@ -31,8 +32,19 @@ int __cdecl wmain(int argc, WCHAR *argv[])
printf("Active code page: %d\n", GetConsoleCP());
return 0;
}
else if (argc == 2)
{
int codepage = _wtoi(argv[1]);
int success = SetConsoleCP(codepage) && SetConsoleOutputCP(codepage);
WINE_FIXME("stub:");
if (!success)
{
printf("Invalid code page\n");
}
return !success;
}
WINE_FIXME("unexpected arguments:");
for (i = 0; i < argc; i++)
WINE_FIXME(" %s", wine_dbgstr_w(argv[i]));
WINE_FIXME("\n");