From 2c4319bbb7331910cb7f4035944604739417629f Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 2 Apr 2005 21:06:44 +0000 Subject: [PATCH] Remove more hardcode string to En.rc svn path=/trunk/; revision=14460 --- reactos/subsys/system/cmd/En.rc | 31 ++++++++++++++++++++++++++++ reactos/subsys/system/cmd/alias.c | 27 +++++++++--------------- reactos/subsys/system/cmd/batch.c | 8 ++++++- reactos/subsys/system/cmd/beep.c | 9 +++++++- reactos/subsys/system/cmd/call.c | 12 +++++++---- reactos/subsys/system/cmd/cls.c | 8 ++++++- reactos/subsys/system/cmd/resource.h | 31 ++++++++++++++++++---------- 7 files changed, 91 insertions(+), 35 deletions(-) diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc index 064a2462fc2..c7c4dbc5cfc 100644 --- a/reactos/subsys/system/cmd/En.rc +++ b/reactos/subsys/system/cmd/En.rc @@ -20,6 +20,24 @@ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n \ /D Processes direcories as well\n\n \ Type ATTRIB without a parameter to display the attributes of all files." +STRING_ALIAS_HELP, "Sets, removes or shows aliases.\n\n \ +ALIAS [alias=[command]]\n\n \ + alias Name for an alias.\n \ + command Text to be substituted for an alias.\n\n \ +To list all aliases:\n \ + ALIAS\n\n \ +To set a new or replace an existing alias:\n \ + ALIAS da=dir a:\n\n \ +To remove an alias from the alias list:\n \ + ALIAS da=" + +STRING_BEEP_HELP, "Beep the speaker.\n\nBEEP" + +STRING_CALL_HELP, "Calls one batch program from another.\n\n \ +CALL [drive:][path]filename [batch-parameter]\n\n \ + batch-parameter Specifies any command-line information required by the\n \ + batch program." + STRING_CD_HELP, "Changes the current directory or displays it's name\n\n \ CHDIR [drive:][path]\n \ CHDIR[..|-]\n \ @@ -39,6 +57,8 @@ CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n \ text Prompt string to display.\n\n \ ERRORLEVEL is set to offset of key user presses in choices." +STRING_CLS_HELP, "Clears the screen.\n\nCLS" + STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT" STRING_MKDIR_HELP, "Creates a directory.\n\n \ @@ -51,6 +71,11 @@ STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]" + + + + + STRING_CHOICE_OPTION "YN" @@ -60,4 +85,10 @@ STRING_CHOICE_ERROR_TXT, "Invalid option. Expected format: /T[:]c,nn" STRING_CHOICE_ERROR_OPTION, "Illegal Option: %s" 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" + + } diff --git a/reactos/subsys/system/cmd/alias.c b/reactos/subsys/system/cmd/alias.c index 820d26bcb4f..8c69eef43f8 100644 --- a/reactos/subsys/system/cmd/alias.c +++ b/reactos/subsys/system/cmd/alias.c @@ -24,10 +24,14 @@ * * 24-Jan-1998 (Eric Kohl ) * Redirection safe! + * + * 02-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef FEATURE_ALIASES @@ -233,6 +237,7 @@ VOID DestroyAlias (VOID) /* specified routines */ VOID ExpandAlias (LPTSTR cmd, INT maxlen) { + WCHAR szMsg[RC_STRING_MAX_SIZE]; unsigned n = 0, m, i, @@ -276,7 +281,8 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen) m = _tcslen (ptr->lpSubst); if ((int)(_tcslen (cmd) - len + m - n) > maxlen) { - ConErrPrintf (_T("Command line too long after alias expansion!\n")); + LoadString( GetModuleHandle(NULL), STRING_ALIAS_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); /* the parser won't cause any problems with an empty line */ cmd[0] = _T('\0'); } @@ -300,25 +306,12 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen) INT CommandAlias (LPTSTR cmd, LPTSTR param) { LPTSTR ptr; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Sets, removes or shows aliases.\n" - "\n" - "ALIAS [alias=[command]]\n" - "\n" - " alias Name for an alias.\n" - " command Text to be substituted for an alias.\n" - "\n" -// "For example:\n" - "To list all aliases:\n" - " ALIAS\n\n" - "To set a new or replace an existing alias:\n" - " ALIAS da=dir a:\n\n" - "To remove an alias from the alias list:\n" - " ALIAS da=" -// "Type ALIAS without a parameter to display the alias list.\n" - )); + LoadString( GetModuleHandle(NULL), STRING_ALIAS_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } diff --git a/reactos/subsys/system/cmd/batch.c b/reactos/subsys/system/cmd/batch.c index 36da188a91e..336227570c1 100644 --- a/reactos/subsys/system/cmd/batch.c +++ b/reactos/subsys/system/cmd/batch.c @@ -54,9 +54,13 @@ * * 23-Feb-2001 (Carl Nettelblad ) * Fixes made to get "for" working. + * + * 02-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* The stack of current batch contexts. @@ -215,6 +219,7 @@ VOID ExitBatch (LPTSTR msg) BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) { HANDLE hFile; + WCHAR szMsg[RC_STRING_MAX_SIZE]; hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | @@ -227,7 +232,8 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) if (hFile == INVALID_HANDLE_VALUE) { - ConErrPrintf (_T("Error opening batch file\n")); + LoadString( GetModuleHandle(NULL), STRING_BATCH_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf (_T((LPTSTR)szMsg)); return FALSE; } diff --git a/reactos/subsys/system/cmd/beep.c b/reactos/subsys/system/cmd/beep.c index 687f0b1a5bc..ae0c9bcdb4d 100644 --- a/reactos/subsys/system/cmd/beep.c +++ b/reactos/subsys/system/cmd/beep.c @@ -19,18 +19,25 @@ * * 20-Jan-1999 (Eric Kohl ) * Redirection ready! + * + * 02-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_BEEP INT cmd_beep (LPTSTR cmd, LPTSTR param) { + WCHAR szMsg[RC_STRING_MAX_SIZE]; + if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts (_T("Beep the speaker.\n\nBEEP")); + LoadString( GetModuleHandle(NULL), STRING_ALIAS_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } diff --git a/reactos/subsys/system/cmd/call.c b/reactos/subsys/system/cmd/call.c index 05e728b68ea..32ca9f899a6 100644 --- a/reactos/subsys/system/cmd/call.c +++ b/reactos/subsys/system/cmd/call.c @@ -24,9 +24,13 @@ * * 20-Jan-1999 (Eric Kohl ) * Unicode and redirection safe! + * + * 02-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" /* @@ -41,16 +45,16 @@ INT cmd_call (LPTSTR cmd, LPTSTR param) { LPBATCH_CONTEXT n = NULL; + WCHAR szMsg[RC_STRING_MAX_SIZE]; #ifdef _DEBUG DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Calls one batch program from another.\n\n" - "CALL [drive:][path]filename [batch-parameter]\n\n" - " batch-parameter Specifies any command-line information required by the\n" - " batch program.")); + LoadString( GetModuleHandle(NULL), STRING_CALL_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } diff --git a/reactos/subsys/system/cmd/cls.c b/reactos/subsys/system/cmd/cls.c index d1dfd3d6fe2..d44cddf3660 100644 --- a/reactos/subsys/system/cmd/cls.c +++ b/reactos/subsys/system/cmd/cls.c @@ -21,9 +21,13 @@ * * 20-Jan-1998 (Eric Kohl ) * Redirection ready! + * + * 02-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_CLS @@ -32,10 +36,12 @@ INT cmd_cls (LPTSTR cmd, LPTSTR param) DWORD dwWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; COORD coPos; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (param, _T("/?"), 2)) { - ConOutPuts (_T("Clears the screen.\n\nCLS")); + LoadString( GetModuleHandle(NULL), STRING_CLS_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); return 0; } diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h index 385a9e01b04..488c20ed9fb 100644 --- a/reactos/subsys/system/cmd/resource.h +++ b/reactos/subsys/system/cmd/resource.h @@ -2,20 +2,29 @@ #define STRING_CHOICE_OPTION 200 -#define STRING_PARAM_ERROR 300 -#define STRING_CHOICE_ERROR 301 -#define STRING_CHOICE_ERROR_TXT 302 -#define STRING_CHOICE_ERROR_OPTION 303 - +#define STRING_ALIAS_ERROR 300 +#define STRING_BATCH_ERROR 301 +#define STRING_CHOICE_ERROR 302 +#define STRING_CHOICE_ERROR_TXT 303 +#define STRING_CHOICE_ERROR_OPTION 304 +#define STRING_PARAM_ERROR 305 #define STRING_ATTRIB_HELP 400 -#define STRING_CD_HELP 401 -#define STRING_CHOICE_HELP 402 -#define STRING_EXIT_HELP 403 -#define STRING_MKDIR_HELP 404 -#define STRING_RMDIR_HELP 405 -#define STRING_REM_HELP 406 +#define STRING_ALIAS_HELP 401 +#define STRING_BEEP_HELP 402 +#define STRING_CALL_HELP 403 +#define STRING_CD_HELP 404 +#define STRING_CHOICE_HELP 405 +#define STRING_CLS_HELP 406 +#define STRING_EXIT_HELP 407 +#define STRING_MKDIR_HELP 408 +#define STRING_RMDIR_HELP 409 +#define STRING_REM_HELP 410 + + + +