--- trunk/reactos/subsys/system/cmd/En.rc 2005-04-02 21:45:38 UTC (rev 14462)
+++ trunk/reactos/subsys/system/cmd/En.rc 2005-04-02 22:19:12 UTC (rev 14463)
@@ -48,6 +48,11 @@
Type CD drive: to display the current directory on the specified drive.\n \
Type CD without a parameter to display the current drive and directory. "
+STRING_CHCP_HELP, "Displays or sets the active code page number.\n\n \
+CHCP [nnn]\n\n \
+ nnn Specifies the active code page number.\n\n \
+Type CHCP without a parameter to display the active code page number."
+
STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n \
CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n \
/C[:]choices Specifies allowable keys. Default is YN.\n \
@@ -59,6 +64,29 @@
STRING_CLS_HELP, "Clears the screen.\n\nCLS"
+STRING_CMD_HELP1, "\nInternal commands available:\n"
+
+STRING_CMD_HELP2, "\nFeatures available:"
+
+STRING_CMD_HELP3," [aliases]"
+
+STRING_CMD_HELP4," [history]"
+
+STRING_CMD_HELP5," [unix filename completion]"
+
+STRING_CMD_HELP6," [directory stack]"
+
+STRING_CMD_HELP7," [redirections and piping]"
+
+STRING_CMD_HELP8, "Starts a new instance of the ReactOS command line interpreter.\n\n \
+CMD [/[C|K] command][/P][/Q][/T:bf]\n\n \
+ /C command Runs the specified command and terminates.\n \
+ /K command Runs the specified command and remains.\n \
+ /P CMD becomes permanent and runs autoexec.bat\n \
+ (cannot be terminated).\n \
+ /T:bf Sets the background/foreground color (see COLOR command)."
+
+
STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"
STRING_MKDIR_HELP, "Creates a directory.\n\n \
@@ -79,16 +107,21 @@
STRING_CHOICE_OPTION "YN"
-
+STRING_ALIAS_ERROR, "Command line too long after alias expansion!\n"
+STRING_BATCH_ERROR, "Error opening batch file\n"
+STRING_CHCP_ERROR1, "Active code page: %u\n"
+STRING_CHCP_ERROR2, "Invalid parameter format - %s\n"
+STRING_CHCP_ERROR3, "Parameter format incorrect - %s\n"
+STRING_CHCP_ERROR4, "Invalid code page\n"
STRING_CHOICE_ERROR, "Invalid option. Expected format: /C[:]options"
STRING_CHOICE_ERROR_TXT, "Invalid option. Expected format: /T[:]c,nn"
STRING_CHOICE_ERROR_OPTION, "Illegal Option: %s"
+STRING_CMD_ERROR1, "Can't redirect input from file %s\n"
+STRING_CMD_ERROR2, "Error creating temporary file for pipe data\n"
+STRING_CMD_ERROR3, "Can't redirect to file %s\n"
+STRING_CMD_ERROR4, "Running %s...\n"
+STRING_CMD_ERROR5, "Running cmdexit.bat...\n"
STRING_PARAM_ERROR, "Required parameter missing\n"
-STRING_ALIAS_ERROR, "Command line too long after alias expansion!\n"
-
-STRING_BATCH_ERROR, "Error opening batch file\n"
-
-
}
--- trunk/reactos/subsys/system/cmd/chcp.c 2005-04-02 21:45:38 UTC (rev 14462)
+++ trunk/reactos/subsys/system/cmd/chcp.c 2005-04-02 22:19:12 UTC (rev 14463)
@@ -7,9 +7,12 @@
* 23-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
+ * 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_CHCP
@@ -19,14 +22,13 @@
INT args;
UINT uOldCodePage;
UINT uNewCodePage;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Displays or sets the active code page number.\n\n"
- "CHCP [nnn]\n\n"
- " nnn Specifies the active code page number.\n\n"
- "Type CHCP without a parameter to display the active code page number."));
+ LoadString( GetModuleHandle(NULL), STRING_CHCP_HELP, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
return 0;
}
@@ -36,14 +38,18 @@
if (args == 0)
{
/* display active code page number */
- ConOutPrintf (_T("Active code page: %u\n"), GetConsoleCP ());
+ LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), GetConsoleCP ());
+
return 0;
}
if (args >= 2)
{
/* too many parameters */
- ConErrPrintf (_T("Invalid parameter format - %s\n"), param);
+ LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), param);
+
return 1;
}
@@ -55,14 +61,16 @@
if (uNewCodePage == 0)
{
- ConErrPrintf (_T("Parameter format incorrect - %s\n"), arg[0]);
+ LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), arg[0]);
freep (arg);
return 1;
}
if (!SetConsoleCP (uNewCodePage))
{
- ConErrPrintf (_T("Invalid code page\n"));
+ LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR4, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
}
else
{
--- trunk/reactos/subsys/system/cmd/cmd.c 2005-04-02 21:45:38 UTC (rev 14462)
+++ trunk/reactos/subsys/system/cmd/cmd.c 2005-04-02 22:19:12 UTC (rev 14463)
@@ -129,9 +129,13 @@
*
* 12-Jul-2004 (Jens Collin <jens.collin@lakhei.com>)
* Added ShellExecute call when all else fails to be able to "launch" any file.
+ *
+ * 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifndef NT_SUCCESS
#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0)
@@ -548,6 +552,7 @@
{
TCHAR cmdline[CMDLINE_LENGTH];
LPTSTR s;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef FEATURE_REDIRECTION
TCHAR in[CMDLINE_LENGTH] = _T("");
TCHAR out[CMDLINE_LENGTH] = _T("");
@@ -629,13 +634,15 @@
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
- ConErrPrintf (_T("Can't redirect input from file %s\n"), in);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), in);
return;
}
if (!SetStdHandle (STD_INPUT_HANDLE, hFile))
{
- ConErrPrintf (_T("Can't redirect input from file %s\n"), in);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), in);
return;
}
#ifdef _DEBUG
@@ -659,7 +666,9 @@
TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
if (hFile[1] == INVALID_HANDLE_VALUE){
- ConErrPrintf (_T("Error creating temporary file for pipe data\n"));
+
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
return;
}
@@ -711,13 +720,16 @@
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
- ConErrPrintf (_T("Can't redirect to file %s\n"), out);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), out);
+
return;
}
if (!SetStdHandle (STD_OUTPUT_HANDLE, hFile))
{
- ConErrPrintf (_T("Can't redirect to file %s\n"), out);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), out);
return;
}
@@ -770,13 +782,17 @@
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
- ConErrPrintf (_T("Can't redirect to file %s\n"), err);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), err);
+
return;
}
}
if (!SetStdHandle (STD_ERROR_HANDLE, hFile))
{
- ConErrPrintf (_T("Can't redirect to file %s\n"), err);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), err);
+
return;
}
@@ -906,6 +922,7 @@
LPTSTR ip;
LPTSTR cp;
BOOL bEchoThisLine;
+
do
{
@@ -1018,6 +1035,7 @@
*/
BOOL WINAPI BreakHandler (DWORD dwCtrlType)
{
+
if ((dwCtrlType != CTRL_C_EVENT) &&
(dwCtrlType != CTRL_BREAK_EVENT))
return FALSE;
@@ -1058,26 +1076,36 @@
static VOID
ShowCommands (VOID)
{
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+
/* print command list */
- ConOutPrintf (_T("\nInternal commands available:\n"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP1, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf (_T((LPTSTR)szMsg));
PrintCommandList ();
/* print feature list */
- ConOutPuts (_T("\nFeatures available:"));
-#ifdef FEATURE_ALIASES
- ConOutPuts (_T(" [aliases]"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP2, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
+
+#ifdef FEATURE_ALIASES
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
#endif
#ifdef FEATURE_HISTORY
- ConOutPuts (_T(" [history]"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP4, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
#endif
#ifdef FEATURE_UNIX_FILENAME_COMPLETION
- ConOutPuts (_T(" [unix filename completion]"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP5, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
#endif
#ifdef FEATURE_DIRECTORY_STACK
- ConOutPuts (_T(" [directory stack]"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP6, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
#endif
#ifdef FEATURE_REDIRECTION
- ConOutPuts (_T(" [redirections and piping]"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP7, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
#endif
ConOutChar (_T('\n'));
}
@@ -1096,6 +1124,8 @@
TCHAR commandline[CMDLINE_LENGTH];
TCHAR ModuleName[_MAX_PATH + 1];
INT i;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+
//INT len;
//TCHAR *ptr, *cmdLine;
@@ -1124,15 +1154,8 @@
if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2))
{
- ConOutPuts (_T("Starts a new instance of the ReactOS command line interpreter.\n"
- "\n"
- "CMD [/[C|K] command][/P][/Q][/T:bf]\n"
- "\n"
- " /C command Runs the specified command and terminates.\n"
- " /K command Runs the specified command and remains.\n"
- " /P CMD becomes permanent and runs autoexec.bat\n"
- " (cannot be terminated).\n"
- " /T:bf Sets the background/foreground color (see COLOR command)."));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_HELP8, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
ExitProcess (0);
}
SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT);
@@ -1236,7 +1259,8 @@
if (IsExistingFile (_T("commandline")))
{
- ConErrPrintf (_T("Running %s...\n", commandline));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR4, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), commandline);
ParseCommandLine (commandline);
}
}
@@ -1267,15 +1291,20 @@
static VOID Cleanup (int argc, TCHAR *argv[])
{
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+
/* run cmdexit.bat */
if (IsExistingFile (_T("cmdexit.bat")))
{
- ConErrPrintf (_T("Running cmdexit.bat...\n"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
+
ParseCommandLine (_T("cmdexit.bat"));
}
else if (IsExistingFile (_T("\\cmdexit.bat")))
{
- ConErrPrintf (_T("Running \\cmdexit.bat...\n"));
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
ParseCommandLine (_T("\\cmdexit.bat"));
}
#ifndef __REACTOS__
@@ -1291,7 +1320,8 @@
if (IsExistingFile (_T("commandline")))
{
- ConErrPrintf (_T("Running %s...\n"), commandline);
+ LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR4, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), commandline);
ParseCommandLine (commandline);
}
}