Remove more hardcode string to En.rc

svn path=/trunk/; revision=14460
This commit is contained in:
Magnus Olsen 2005-04-02 21:06:44 +00:00
parent 3acecc6fd4
commit 2c4319bbb7
7 changed files with 91 additions and 35 deletions

View file

@ -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"
}

View file

@ -24,10 +24,14 @@
*
* 24-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection safe!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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;
}

View file

@ -54,9 +54,13 @@
*
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.es>)
* Fixes made to get "for" working.
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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;
}

View file

@ -19,18 +19,25 @@
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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;
}

View file

@ -24,9 +24,13 @@
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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;
}

View file

@ -21,9 +21,13 @@
*
* 20-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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;
}

View file

@ -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