2 * CHCP.C - chcp internal command.
7 * 23-Dec-1998 (Eric Kohl)
10 * 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
11 * Remove all hardcode string to En.rc
18 #ifdef INCLUDE_CMD_CHCP
20 INT
CommandChcp (LPTSTR cmd
, LPTSTR param
)
27 if (!_tcsncmp (param
, _T("/?"), 2))
29 ConOutResPaging(TRUE
,STRING_CHCP_HELP
);
36 arg
= split (param
, &args
, FALSE
);
40 /* display active code page number */
41 ConErrResPrintf(STRING_CHCP_ERROR1
, InputCodePage
);
48 /* too many parameters */
49 ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT
, param
);
55 uNewCodePage
= (UINT
)_ttoi(arg
[0]);
57 if (uNewCodePage
== 0)
59 ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT
, arg
[0]);
65 if (!SetConsoleCP(uNewCodePage
))
67 ConErrResPuts(STRING_CHCP_ERROR4
);
72 SetConsoleOutputCP (uNewCodePage
);
74 InputCodePage
= GetConsoleCP();
82 #endif /* INCLUDE_CMD_CHCP */