2 * CHCP.C - chcp internal command.
7 * 23-Dec-1998 (Eric Kohl)
10 * 02-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
11 * Remove all hardcoded strings in En.rc
16 #ifdef INCLUDE_CMD_CHCP
18 INT
CommandChcp (LPTSTR param
)
25 if (!_tcsncmp (param
, _T("/?"), 2))
27 ConOutResPaging(TRUE
,STRING_CHCP_HELP
);
34 arg
= split (param
, &args
, FALSE
, FALSE
);
38 /* display active code page number */
39 ConErrResPrintf(STRING_CHCP_ERROR1
, InputCodePage
);
46 /* too many parameters */
47 ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT
, param
);
53 uNewCodePage
= (UINT
)_ttoi(arg
[0]);
55 if (uNewCodePage
== 0)
57 ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT
, arg
[0]);
63 if (!SetConsoleCP(uNewCodePage
))
65 ConErrResPuts(STRING_CHCP_ERROR4
);
70 SetConsoleOutputCP (uNewCodePage
);
72 InputCodePage
= GetConsoleCP();
79 #endif /* INCLUDE_CMD_CHCP */