diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc index 8dd300dff4b..7893b923452 100644 --- a/reactos/subsys/system/cmd/En.rc +++ b/reactos/subsys/system/cmd/En.rc @@ -86,7 +86,54 @@ CMD [/[C|K] command][/P][/Q][/T:bf]\n\n \ (cannot be terminated).\n \ /T:bf Sets the background/foreground color (see COLOR command)." +STRING_COLOR_HELP1, "Sets the default foreground and background colors.\n\n \ +COLOR [attr [/F]] \n\n \ + attr Specifies color attribute of console output\n \ + /F fill the console with color attribute\n\n \ +There are three ways to specify the colors:\n \ +1) [bright] name on [bright] name (only the first three letters are required)\n \ +2) decimal on decimal\n \ +3) two hex digits\n\n \ +Colors are:\n \ +dec hex name dec hex name\n \ +0 0 Black 8 8 Gray(Bright black)\n \ +1 1 Blue 9 9 Bright Blue\n \ +2 2 Green 10 A Bright Green\n \ +3 3 Cyan 11 B Bright Cyan\n \ +4 4 Red 12 C Bright Red\n \ +5 5 Magenta 13 D Bright Magenta\n \ +6 6 Yellow 14 E Bright Yellow\n \ +7 7 White 15 F Bright White" +STRING_COPY_HELP1, "Overwrite %s (Yes/No/All)? " + +STRING_COPY_HELP2, "Copies one or more files to another location.\n\n \ +COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n \ + [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n \ + source Specifies the file or files to be copied.\n \ + /A Indicates an ASCII text file.\n \ + /B Indicates a binary file.\n \ + destination Specifies the directory and/or filename for the new file(s).\n \ + /V Verifies that new files are written correctly.\n \ + /Y Suppresses prompting to confirm you want to overwrite an\n \ + existing destination file.\n \ + /-Y Causes prompting to confirm you want to overwrite an\n \ + existing destination file.\n\n \ +The switch /Y may be present in the COPYCMD environment variable.\n \ +..." + +STRING_DATE_HELP1, "\nEnter new date (mm%cdd%cyyyy): " + +STRING_DATE_HELP2, "\nEnter new date (dd%cmm%cyyyy): " + +STRING_DATE_HELP3, "\nEnter new date (yyyy%cmm%cdd): " + +STRING_DATE_HELP4, "Displays or sets the date.\n\n \ +DATE [/T][date]\n\n \ + /T display only\n\n \ +Type DATE without parameters to display the current date setting and\n \ +a prompt for a new one. Press ENTER to keep the same date." + STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT" STRING_MKDIR_HELP, "Creates a directory.\n\n \ @@ -103,8 +150,8 @@ STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]" - -STRING_CHOICE_OPTION "YN" +STRING_CHOICE_OPTION, "YN" +STRING_COPY_OPTION, "YNA" STRING_ALIAS_ERROR, "Command line too long after alias expansion!\n" @@ -121,6 +168,12 @@ 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_CONSOLE_ERROR, "Unknown error: %d\n" +STRING_COPY_ERROR1, "Error: Cannot open source - %s!\n" +STRING_COPY_ERROR2, "Error: Can't copy onto itself!\n" +STRING_COPY_ERROR3, "Error writing destination!\n" +STRING_COPY_ERROR4, "Error: Not implemented yet!\n" +STRING_DATE_ERROR, "Invalid date." STRING_PARAM_ERROR, "Required parameter missing\n" diff --git a/reactos/subsys/system/cmd/color.c b/reactos/subsys/system/cmd/color.c index 61cb290a912..4f04306a36c 100644 --- a/reactos/subsys/system/cmd/color.c +++ b/reactos/subsys/system/cmd/color.c @@ -16,44 +16,23 @@ * * 14-Oct-1999 (Paolo Pantaleo ) * 4nt's syntax implemented + * + * 03-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_COLOR static VOID ColorHelp (VOID) { - ConOutPuts (_T( - "Sets the default foreground and background colors.\n" - "\n" - "COLOR [attr [/F]] \n\n" - " attr Specifies color attribute of console output\n" - " /F fill the console with color attribute\n" - "\n" - "There are three ways to specify the colors:" - )); + WCHAR szMsg[RC_STRING_MAX_SIZE]; + LoadString( GetModuleHandle(NULL), STRING_COLOR_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); - ConOutPuts (_T( - "\n" - "1) [bright] name on [bright] name (only the first three letters are required)\n" - "2) decimal on decimal\n" - "3) two hex digits\n" - "\n" - "Colors are:" - )); - - ConOutPuts (_T( - "dec hex name dec hex name\n" - "0 0 Black 8 8 Gray(Bright black)\n" - "1 1 Blue 9 9 Bright Blue\n" - "2 2 Green 10 A Bright Green\n" - "3 3 Cyan 11 B Bright Cyan\n" - "4 4 Red 12 C Bright Red\n" - "5 5 Magenta 13 D Bright Magenta\n" - "6 6 Yellow 14 E Bright Yellow\n" - "7 7 White 15 F Bright White")); } diff --git a/reactos/subsys/system/cmd/console.c b/reactos/subsys/system/cmd/console.c index 5d77e35dfdf..4c72ad446bb 100644 --- a/reactos/subsys/system/cmd/console.c +++ b/reactos/subsys/system/cmd/console.c @@ -7,9 +7,13 @@ * * 20-Jan-1999 (Eric Kohl ) * started + * + * 03-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #define OUTPUT_BUFFER_SIZE 4096 @@ -210,6 +214,7 @@ VOID ConOutFormatMessage (DWORD MessageId, ...) DWORD ret; LPTSTR text; va_list arg_ptr; + WCHAR szMsg[RC_STRING_MAX_SIZE]; va_start (arg_ptr, MessageId); ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, @@ -228,7 +233,8 @@ VOID ConOutFormatMessage (DWORD MessageId, ...) } else { - ConErrPrintf (_T("Unknown error: %d\n"), MessageId); + LoadString( GetModuleHandle(NULL), STRING_CONSOLE_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); } } diff --git a/reactos/subsys/system/cmd/copy.c b/reactos/subsys/system/cmd/copy.c index 091b4616d41..8ee5aa0e2cf 100644 --- a/reactos/subsys/system/cmd/copy.c +++ b/reactos/subsys/system/cmd/copy.c @@ -20,9 +20,13 @@ * * 27-Oct-1998 (Eric Kohl ) * Disabled prompting when used in batch mode. + * + * 03-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_COPY @@ -294,8 +298,17 @@ Overwrite (LPTSTR fn) { TCHAR inp[10]; LPTSTR p; + + LPTSTR lpOptions; + TCHAR Options[3]; + WCHAR szMsg[RC_STRING_MAX_SIZE]; - ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn); + LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR) Options,sizeof(lpOptions)); + lpOptions = _T(Options); + + LoadString( GetModuleHandle(NULL), STRING_COPY_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg)); + ConInString (inp, 10); ConOutPuts (_T("")); @@ -303,9 +316,9 @@ Overwrite (LPTSTR fn) for (p = inp; _istspace (*p); p++) ; - if (*p != _T('Y') && *p != _T('A')) + if (*p != lpOptions[0] && *p != lpOptions[2]) return 0; - if (*p == _T('A')) + if (*p == lpOptions[2]) return 2; return 1; @@ -326,6 +339,7 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) DWORD dwWritten; DWORD i; BOOL bEof = FALSE; + WCHAR szMsg[RC_STRING_MAX_SIZE]; #ifdef _DEBUG DebugPrintf (_T("checking mode\n")); @@ -337,7 +351,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) NULL, OPEN_EXISTING, 0, NULL); if (hFileSrc == INVALID_HANDLE_VALUE) { - ConErrPrintf (_T("Error: Cannot open source - %s!\n"), source); + LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg), source); return 0; } @@ -364,7 +379,9 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) { if (!_tcscmp (dest, source)) { - ConErrPrintf (_T("Error: Can't copy onto itself!\n")); + LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR2, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg), source); + CloseHandle (hFileSrc); return 0; } @@ -438,7 +455,10 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags) WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL); if (dwWritten != dwRead) { - ConErrPrintf (_T("Error writing destination!\n")); + + LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR3, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); + free (buffer); CloseHandle (hFileDest); CloseHandle (hFileSrc); @@ -618,6 +638,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest) TCHAR dir_d[_MAX_DIR]; TCHAR file_d[_MAX_FNAME]; TCHAR ext_d[_MAX_EXT]; + WCHAR szMsg[RC_STRING_MAX_SIZE]; int argc; int append; @@ -634,23 +655,8 @@ INT cmd_copy (LPTSTR first, LPTSTR rest) if (!_tcsncmp (rest, _T("/?"), 2)) { - ConOutPuts (_T("Copies one or more files to another location.\n" - "\n" - "COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n" - " [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n" - "\n" - " source Specifies the file or files to be copied.\n" - " /A Indicates an ASCII text file.\n" - " /B Indicates a binary file.\n" - " destination Specifies the directory and/or filename for the new file(s).\n" - " /V Verifies that new files are written correctly.\n" - " /Y Suppresses prompting to confirm you want to overwrite an\n" - " existing destination file.\n" - " /-Y Causes prompting to confirm you want to overwrite an\n" - " existing destination file.\n" - "\n" - "The switch /Y may be present in the COPYCMD environment variable.\n" - "...")); + LoadString( GetModuleHandle(NULL), STRING_COPY_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 1; } @@ -722,7 +728,9 @@ INT cmd_copy (LPTSTR first, LPTSTR rest) } else if (bDestFound && bWildcards) { - ConErrPrintf (_T("Error: Not implemented yet!\n")); + LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR4, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); + DeleteFileList (sources); freep (p); return 0; diff --git a/reactos/subsys/system/cmd/date.c b/reactos/subsys/system/cmd/date.c index 90b9d713aa5..994614f2b50 100644 --- a/reactos/subsys/system/cmd/date.c +++ b/reactos/subsys/system/cmd/date.c @@ -26,9 +26,13 @@ * * 04-Feb-1999 (Eric Kohl ) * Fixed date input bug. + * + * 03-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_DATE @@ -43,22 +47,24 @@ static WORD awMonths[2][13] = static VOID PrintDateString (VOID) { + WCHAR szMsg[RC_STRING_MAX_SIZE]; + switch (nDateFormat) { case 0: /* mmddyy */ default: - ConOutPrintf (_T("\nEnter new date (mm%cdd%cyyyy): "), - cDateSeparator, cDateSeparator); + LoadString( GetModuleHandle(NULL), STRING_DATE_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator, cDateSeparator); break; case 1: /* ddmmyy */ - ConOutPrintf (_T("\nEnter new date (dd%cmm%cyyyy): "), - cDateSeparator, cDateSeparator); + LoadString( GetModuleHandle(NULL), STRING_DATE_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator, cDateSeparator); break; case 2: /* yymmdd */ - ConOutPrintf (_T("\nEnter new date (yyyy%cmm%cdd): "), - cDateSeparator, cDateSeparator); + LoadString( GetModuleHandle(NULL), STRING_DATE_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator, cDateSeparator); break; } } @@ -183,14 +189,12 @@ INT cmd_date (LPTSTR cmd, LPTSTR param) INT i; BOOL bPrompt = TRUE; INT nDateString = -1; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays or sets the date.\n\n" - "DATE [/T][date]\n\n" - " /T display only\n\n" - "Type DATE without parameters to display the current date setting and\n" - "a prompt for a new one. Press ENTER to keep the same date.")); + LoadString( GetModuleHandle(NULL), STRING_DATE_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } @@ -243,7 +247,9 @@ INT cmd_date (LPTSTR cmd, LPTSTR param) freep (arg); return 0; } - ConErrPuts (_T("Invalid date.")); + LoadString( GetModuleHandle(NULL), STRING_DATE_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPuts (_T((LPTSTR)szMsg)); + } freep (arg); diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h index 6e6d746eb27..78952c0c4c4 100644 --- a/reactos/subsys/system/cmd/resource.h +++ b/reactos/subsys/system/cmd/resource.h @@ -1,6 +1,7 @@ #define RC_STRING_MAX_SIZE 2048 #define STRING_CHOICE_OPTION 200 +#define STRING_COPY_OPTION 201 #define STRING_ALIAS_ERROR 300 @@ -17,7 +18,13 @@ #define STRING_CMD_ERROR3 311 #define STRING_CMD_ERROR4 312 #define STRING_CMD_ERROR5 313 -#define STRING_PARAM_ERROR 314 +#define STRING_CONSOLE_ERROR 314 +#define STRING_COPY_ERROR1 315 +#define STRING_COPY_ERROR2 316 +#define STRING_COPY_ERROR3 317 +#define STRING_COPY_ERROR4 318 +#define STRING_DATE_ERROR 319 +#define STRING_PARAM_ERROR 320 #define STRING_ATTRIB_HELP 400 #define STRING_ALIAS_HELP 401 @@ -35,10 +42,17 @@ #define STRING_CMD_HELP6 413 #define STRING_CMD_HELP7 414 #define STRING_CMD_HELP8 415 -#define STRING_EXIT_HELP 416 -#define STRING_MKDIR_HELP 417 -#define STRING_RMDIR_HELP 418 -#define STRING_REM_HELP 419 +#define STRING_COLOR_HELP1 416 +#define STRING_COPY_HELP1 417 +#define STRING_COPY_HELP2 418 +#define STRING_DATE_HELP1 419 +#define STRING_DATE_HELP2 420 +#define STRING_DATE_HELP3 421 +#define STRING_DATE_HELP4 422 +#define STRING_EXIT_HELP 423 +#define STRING_MKDIR_HELP 424 +#define STRING_RMDIR_HELP 425 +#define STRING_REM_HELP 426