Remove all hardcode string to En.rc

svn path=/trunk/; revision=14870
This commit is contained in:
Magnus Olsen 2005-04-30 13:13:36 +00:00
parent 04dd142850
commit e705463f4a
5 changed files with 94 additions and 42 deletions

View file

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

View file

@ -15,9 +15,13 @@
*
* 17-Oct-2001 (Eric Kohl <ekohl@rz.online.de>
* Implemented basic rename code.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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);

View file

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

View file

@ -6,9 +6,13 @@
*
* 24-Jul-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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
{

View file

@ -19,9 +19,13 @@
*
* 04-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed time input bug.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* 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);