From e705463f4a739c9c160a21871855f34b58b9c078 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 30 Apr 2005 13:13:36 +0000 Subject: [PATCH] Remove all hardcode string to En.rc svn path=/trunk/; revision=14870 --- reactos/subsys/system/cmd/En.rc | 38 ++++++++++++++++++++++++++-- reactos/subsys/system/cmd/ren.c | 38 +++++++++++++--------------- reactos/subsys/system/cmd/resource.h | 22 ++++++++++++---- reactos/subsys/system/cmd/start.c | 16 ++++++++---- reactos/subsys/system/cmd/time.c | 22 ++++++++-------- 5 files changed, 94 insertions(+), 42 deletions(-) diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc index 163eae5fbbf..4da146d15e3 100644 --- a/reactos/subsys/system/cmd/En.rc +++ b/reactos/subsys/system/cmd/En.rc @@ -355,6 +355,23 @@ STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]" STRING_RMDIR_HELP, "Removes a directory.\n\n \ RMDIR [drive:]path\nRD [drive:]path" +STRING_REN_HELP1, "Renames a file/directory or files/directories.\n\n \ +RENAME [/E /N /P /Q /S /T] old_name ... new_name\n \ +REN [/E /N /P /Q /S /T] old_name ... new_name\n\n \ + /E No eror messages.\n \ + /N Nothing.\n \ + /P Prompts for confirmation before renaming each file.\n \ + (Not implemented yet!)\n \ + /Q Quiet.\n \ + /S Rename subdirectories.\n \ + /T Display total number of renamed files.\n\n \ +Note that you cannot specify a new drive or path for your destination. Use\n \ +the MOVE command for that purpose." + +STRING_REN_HELP2, " %lu file renamed\n" + +STRING_REN_HELP3, " %lu files renamed\n" + STRING_SHIFT_HELP, "Changes the position of replaceable parameters in a batch file.\n\n \ SHIFT [DOWN]" @@ -369,11 +386,22 @@ SET [variable[=][string]]\n\n \ string Specifies a series of characters to assign to the variable.\n\n \ Type SET without parameters to display the current environment variables.\n" +STRING_START_HELP1, "Starts a command.\n\n \ +START command \n\n \ + command Specifies the command to run.\n\n \ +At the moment all commands are started asynchronously.\n" + STRING_TITLE_HELP, "Sets the window title for the command prompt window.\n\n \ TITLE [string]\n\n \ string Specifies the title for the command prompt window." - +STRING_TIME_HELP1, "Displays or sets the system time.\n\n \ +TIME [/T][time]\n\n \ + /T display only\n\n \ +Type TIME with no parameters to display the current time setting and a prompt\n \ +for a new one. Press ENTER to keep the same time." + +STRING_TIME_HELP2, "Enter new time: " @@ -431,7 +459,13 @@ STRING_MOVE_ERROR2, "[Error]\n" STRING_PARAM_ERROR, "Required parameter missing\n" -STRING_PATH_ERROR "CMD: Not in environment 'PATH'\n" +STRING_PATH_ERROR, "CMD: Not in environment 'PATH'\n" + +STRING_REN_ERROR1, "MoveFile() failed. Error: %lu\n" + +STRING_START_ERROR1, "No batch support at the moment!" + +STRING_TIME_ERROR1, "Invalid time." STRING_ERROR_PARAMETERF_ERROR, "Parameter format not correct - %c\n" STRING_ERROR_INVALID_SWITCH, "Invalid switch - /%c\n" diff --git a/reactos/subsys/system/cmd/ren.c b/reactos/subsys/system/cmd/ren.c index 344cbd5f162..f4276dd6ef1 100644 --- a/reactos/subsys/system/cmd/ren.c +++ b/reactos/subsys/system/cmd/ren.c @@ -15,9 +15,13 @@ * * 17-Oct-2001 (Eric Kohl * Implemented basic rename code. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_RENAME @@ -54,24 +58,13 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) HANDLE hFile; WIN32_FIND_DATA f; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp(param, _T("/?"), 2)) { - ConOutPuts(_T("Renames a file/directory or files/directories.\n" - "\n" - "RENAME [/E /N /P /Q /S /T] old_name ... new_name\n" - "REN [/E /N /P /Q /S /T] old_name ... new_name\n" - "\n" - " /E No eror messages.\n" - " /N Nothing.\n" - " /P Prompts for confirmation before renaming each file.\n" - " (Not implemented yet!)\n" - " /Q Quiet.\n" - " /S Rename subdirectories.\n" - " /T Display total number of renamed files.\n" - "\n" - "Note that you cannot specify a new drive or path for your destination. Use\n" - "the MOVE command for that purpose.")); + LoadString( GetModuleHandle(NULL), STRING_REN_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts((LPTSTR)szMsg); + return(0); } @@ -245,7 +238,10 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) else { if (!(dwFlags & REN_ERROR)) - ConErrPrintf(_T("MoveFile() failed. Error: %lu\n"), GetLastError()); + { + LoadString( GetModuleHandle(NULL), STRING_REN_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf ((LPTSTR)szMsg, GetLastError()); + } } } } @@ -256,13 +252,15 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param) if (!(dwFlags & REN_QUIET)) { if (dwFiles == 1) - ConOutPrintf(_T(" %lu file renamed\n"), - dwFiles); + LoadString( GetModuleHandle(NULL), STRING_REN_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); else - ConOutPrintf(_T(" %lu files renamed\n"), - dwFiles); + LoadString( GetModuleHandle(NULL), STRING_REN_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); + + ConOutPrintf((LPTSTR)szMsg,dwFiles); } + + freep(arg); return(0); diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h index 7244a2c3bbb..7fde5f08169 100644 --- a/reactos/subsys/system/cmd/resource.h +++ b/reactos/subsys/system/cmd/resource.h @@ -65,6 +65,9 @@ #define STRING_MOVE_ERROR2 343 #define STRING_PARAM_ERROR 344 #define STRING_PATH_ERROR 345 +#define STRING_REN_ERROR1 346 +#define STRING_START_ERROR1 347 +#define STRING_TIME_ERROR1 348 @@ -158,15 +161,24 @@ #define STRING_REM_HELP 670 -#define STRING_RMDIR_HELP 671 +#define STRING_REN_HELP1 671 +#define STRING_REN_HELP2 672 +#define STRING_REN_HELP3 673 -#define STRING_SCREEN_HELP 672 +#define STRING_RMDIR_HELP 672 -#define STRING_SHIFT_HELP 673 +#define STRING_SCREEN_HELP 673 -#define STRING_SET_HELP 674 +#define STRING_SHIFT_HELP 674 -#define STRING_TITLE_HELP 675 +#define STRING_SET_HELP 675 + +#define STRING_START_HELP1 676 + +#define STRING_TITLE_HELP 677 + +#define STRING_TIME_HELP1 678 +#define STRING_TIME_HELP2 679 diff --git a/reactos/subsys/system/cmd/start.c b/reactos/subsys/system/cmd/start.c index 023b46b3994..1503bac2065 100644 --- a/reactos/subsys/system/cmd/start.c +++ b/reactos/subsys/system/cmd/start.c @@ -6,9 +6,13 @@ * * 24-Jul-1999 (Eric Kohl ) * Started. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_START @@ -18,13 +22,13 @@ INT cmd_start (LPTSTR first, LPTSTR rest) TCHAR szFullName[MAX_PATH]; BOOL bWait = FALSE; TCHAR *param; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (_tcsncmp (rest, _T("/?"), 2) == 0) { - ConOutPuts (_T("Starts a command.\n\n" - "START command \n\n" - " command Specifies the command to run.\n\n" - "At the moment all commands are started asynchronously.\n")); + + LoadString( GetModuleHandle(NULL), STRING_START_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts((LPTSTR)szMsg); return 0; } @@ -68,7 +72,9 @@ INT cmd_start (LPTSTR first, LPTSTR rest) #ifdef _DEBUG DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest); #endif - ConErrPuts (_T("No batch support at the moment!")); + + LoadString( GetModuleHandle(NULL), STRING_START_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPuts ((LPTSTR)szMsg); } else { diff --git a/reactos/subsys/system/cmd/time.c b/reactos/subsys/system/cmd/time.c index 160b59a8a81..8ddb121d0c0 100644 --- a/reactos/subsys/system/cmd/time.c +++ b/reactos/subsys/system/cmd/time.c @@ -19,9 +19,13 @@ * * 04-Feb-1999 (Eric Kohl ) * Fixed time input bug. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_TIME @@ -133,17 +137,13 @@ INT cmd_time (LPTSTR cmd, LPTSTR param) INT i; BOOL bPrompt = TRUE; INT nTimeString = -1; + WCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Displays or sets the system time.\n" - "\n" - "TIME [/T][time]\n" - "\n" - " /T display only\n" - "\n" - "Type TIME with no parameters to display the current time setting and a prompt\n" - "for a new one. Press ENTER to keep the same time.")); + LoadString( GetModuleHandle(NULL), STRING_TIME_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts((LPTSTR)szMsg); return 0; } @@ -175,7 +175,8 @@ INT cmd_time (LPTSTR cmd, LPTSTR param) { TCHAR s[40]; - ConOutPrintf (_T("Enter new time: ")); + LoadString( GetModuleHandle(NULL), STRING_TIME_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf ((LPTSTR)szMsg); ConInString (s, 40); @@ -203,7 +204,8 @@ INT cmd_time (LPTSTR cmd, LPTSTR param) /* force input the next time around. */ nTimeString = -1; } - ConErrPuts (_T("Invalid time.")); + LoadString( GetModuleHandle(NULL), STRING_TIME_ERROR1, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPuts ((LPTSTR)szMsg); } freep (arg);