Remove more hardcode string to En.rc
Modified: trunk/reactos/subsys/system/cmd/En.rc
Modified: trunk/reactos/subsys/system/cmd/color.c
Modified: trunk/reactos/subsys/system/cmd/copy.c
Modified: trunk/reactos/subsys/system/cmd/del.c
Modified: trunk/reactos/subsys/system/cmd/resource.h
_____
Modified: trunk/reactos/subsys/system/cmd/En.rc
--- trunk/reactos/subsys/system/cmd/En.rc 2005-04-03 13:04:10 UTC
(rev 14475)
+++ trunk/reactos/subsys/system/cmd/En.rc 2005-04-03 13:40:15 UTC
(rev 14476)
@@ -134,6 +134,23 @@
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_DEL_HELP1, "Deletes one or more files.\n\n \
+DEL [/%c /%c /%c /%c /%c /%c /%c] file ...\n \
+DELETE [/%c /%c /%c /%c /%c /%c /%c] file ...\n \
+ERASE [/%c /%c /%c /%c /%c /%c /%c] file ...\n\n \
+ file Specifies the file(s) to delete.\n\n \
+ /%c Nothing.\n \
+ /%c Prompt. Ask before deleting each file.\n \
+ /%c Total. Display total number of deleted files and freed disk
space.\n \
+ /%c Quiet.\n \
+ /%c Wipe. Overwrite the file with random numbers before deleting
it.\n \
+ /%c Yes. Kill even *.* without asking.\n \
+ /%c Zap. Delete hidden, read-only and system files).\n"
+
+STRING_DEL_HELP3, " %lu file%s deleted\n"
+
+STRING_DEL_HELP4, " %lu files deleted\n"
+
STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"
STRING_MKDIR_HELP, "Creates a directory.\n\n \
@@ -144,14 +161,18 @@
STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM
[Comment]"
+STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you
sure (Y/N)?"
+
+
STRING_CHOICE_OPTION, "YN"
STRING_COPY_OPTION, "YNA"
+STRING_DEL_OPTION, "AENPQSTWXYZ"
STRING_ALIAS_ERROR, "Command line too long after alias
expansion!\n"
@@ -168,12 +189,24 @@
STRING_CMD_ERROR3, "Can't redirect to file %s\n"
STRING_CMD_ERROR4, "Running %s...\n"
STRING_CMD_ERROR5, "Running cmdexit.bat...\n"
+STRING_COLOR_ERROR1, "Same colors error! (Background and
foreground can't be the same color)"
+STRING_COLOR_ERROR2, "error in color specification"
+STRING_COLOR_ERROR3, "Color %x\n"
+STRING_COLOR_ERROR4, "same colors error!"
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_DEL_ERROR1, "Wildcards!\n\n"
+STRING_DEL_ERROR2, "Full path: %s\n"
+STRING_DEL_ERROR3, "File part: %s\n"
+STRING_DEL_ERROR4, "Full filename: %s\n"
+STRING_DEL_ERROR5, "The file %s will be deleted! "
+STRING_DEL_ERROR6, "Are you sure (Y/N)?"
+STRING_DEL_ERROR7, "Deleting: %s\n"
+STRING_DEL_ERROR8, "No Wildcards!\n"
STRING_PARAM_ERROR, "Required parameter missing\n"
_____
Modified: trunk/reactos/subsys/system/cmd/color.c
--- trunk/reactos/subsys/system/cmd/color.c 2005-04-03 13:04:10 UTC
(rev 14475)
+++ trunk/reactos/subsys/system/cmd/color.c 2005-04-03 13:40:15 UTC
(rev 14476)
@@ -41,10 +41,12 @@
DWORD dwWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
- ConErrPuts (_T("Same colors error! (Background and foreground
can't be the same color)"));
+ LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPuts (_T((LPTSTR)szMsg));
}
else
{
@@ -72,6 +74,8 @@
*/
INT CommandColor (LPTSTR first, LPTSTR rest)
{
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+
if (_tcsncmp (rest, _T("/?"), 2) == 0)
{
ColorHelp ();
@@ -88,15 +92,18 @@
if (StringToColor (&wColor, &rest) == FALSE)
{
- ConErrPuts(_T("error in color specification"));
+ LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR2,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPuts (_T((LPTSTR)szMsg));
return 1;
}
- ConErrPrintf (_T("Color %x\n"), wColor);
+ LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR3, (LPTSTR)
szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), wColor);
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
- ConErrPuts (_T("same colors error!"));
+ LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR4,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), wColor);
return 1;
}
_____
Modified: trunk/reactos/subsys/system/cmd/copy.c
--- trunk/reactos/subsys/system/cmd/copy.c 2005-04-03 13:04:10 UTC
(rev 14475)
+++ trunk/reactos/subsys/system/cmd/copy.c 2005-04-03 13:40:15 UTC
(rev 14476)
@@ -303,7 +303,7 @@
TCHAR Options[3];
WCHAR szMsg[RC_STRING_MAX_SIZE];
- LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR)
Options,sizeof(lpOptions));
+ LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR)
Options,sizeof(Options)+sizeof(WCHAR));
lpOptions = _T(Options);
LoadString( GetModuleHandle(NULL), STRING_COPY_HELP1, (LPTSTR)
szMsg,sizeof(szMsg));
_____
Modified: trunk/reactos/subsys/system/cmd/del.c
--- trunk/reactos/subsys/system/cmd/del.c 2005-04-03 13:04:10 UTC
(rev 14475)
+++ trunk/reactos/subsys/system/cmd/del.c 2005-04-03 13:40:15 UTC
(rev 14476)
@@ -35,6 +35,7 @@
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_DEL
@@ -108,29 +109,30 @@
HANDLE hFile;
WIN32_FIND_DATA f;
+ LPTSTR lpOptions;
+ TCHAR Options[11];
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+ LONG ch;
+
+
+
+ LoadString( GetModuleHandle(NULL), STRING_DEL_OPTION, (LPTSTR)
Options,sizeof(Options)+sizeof(WCHAR));
+ lpOptions = _T(Options);
+
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Deletes one or more files.\n"
- "\n"
- "DEL [/N /P /T /Q /W /Y /Z] file ...\n"
- "DELETE [/N /P /T /Q /W /Y /Z] file
...\n"
- "ERASE [/N /P /T /Q /W /Y /Z] file ...\n"
- "\n"
- " file Specifies the file(s) to
delete.\n"
- "\n"
- " /N Nothing.\n"
- " /P Prompt. Ask before deleting each
file.\n"
- " /T Total. Display total number of
deleted files and freed disk space.\n"
- " /Q Quiet.\n"
- " /W Wipe. Overwrite the file with
random numbers before deleting it.\n"
- " /Y Yes. Kill even *.* without
asking.\n"
- " /Z Zap. Delete hidden, read-only
and system files).\n"));
-
+ LoadString( GetModuleHandle(NULL), STRING_DEL_HELP1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf (_T((LPTSTR)szMsg),
+
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions
[9],lpOptions[10],
+
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions
[9],lpOptions[10],
+
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions
[9],lpOptions[10],
+
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions
[9],lpOptions[10]
+ );
return 0;
}
arg = split (param, &args, FALSE);
-
+
if (args > 0)
{
/* check for options anywhere in command line */
@@ -140,39 +142,49 @@
{
if (_tcslen (arg[i]) >= 2)
{
- switch (_totupper (arg[i][1]))
- {
- case _T('N'):
- dwFlags |=
DEL_NOTHING;
- break;
+
+ ch = _totupper (arg[i][1]);
+
+ if (_totupper (lpOptions[2]) == ch)
+ {
+ dwFlags |= DEL_NOTHING;
+ }
- case _T('P'):
- dwFlags |=
DEL_PROMPT;
- break;
+ else if (_totupper (lpOptions[3]) ==
ch)
+ {
+ dwFlags |= DEL_PROMPT;
+ }
+
+ else if (_totupper (lpOptions[4]) ==
ch)
+ {
+ dwFlags |= DEL_QUIET;
+ }
- case _T('Q'):
- dwFlags |=
DEL_QUIET;
- break;
+ else if (_totupper (lpOptions[5]) ==
ch)
+ {
+ dwFlags |= DEL_SUBDIR;
+ }
- case _T('S'):
- dwFlags |=
DEL_SUBDIR;
- break;
+ else if (_totupper (lpOptions[6]) ==
ch)
+ {
+ dwFlags |= DEL_TOTAL;
+ }
- case _T('T'):
- dwFlags |=
DEL_TOTAL;
- break;
+ else if (_totupper (lpOptions[7]) ==
ch)
+ {
+ dwFlags |= DEL_WIPE;
+ }
- case _T('W'):
- dwFlags |=
DEL_WIPE;
- break;
- case _T('Y'):
- dwFlags |=
DEL_YES;
- break;
- case _T('Z'):
- dwFlags |=
DEL_ZAP;
- break;
- }
+ else if (_totupper (lpOptions[9]) == ch)
+ {
+ dwFlags |= DEL_YES;
+ }
+ else if (_totupper (lpOptions[10]) ==
ch)
+ {
+ dwFlags |= DEL_ZAP;
+ }
+
}
nEvalArgs++;
@@ -199,9 +211,11 @@
{
if (!((dwFlags & DEL_YES) || (dwFlags &
DEL_QUIET) || (dwFlags & DEL_PROMPT)))
{
- res = FilePromptYN (_T("All
files in the directory will be deleted!\n"
- "Are you
sure (Y/N)?"));
+
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_HELP2, (LPTSTR) szMsg,sizeof(szMsg));
+ res = FilePromptYN (_T( (LPTSTR)
szMsg));
+
if ((res == PROMPT_NO) || (res
== PROMPT_BREAK))
break;
}
@@ -217,7 +231,8 @@
{
/* wildcards in filespec */
#ifdef _DEBUG
- ConErrPrintf
(_T("Wildcards!\n\n"));
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
#endif
GetFullPathName (arg[i],
@@ -226,8 +241,12 @@
&pFilePart);
#ifdef _DEBUG
- ConErrPrintf (_T("Full path:
%s\n"), szFullPath);
- ConErrPrintf (_T("File part:
%s\n"), pFilePart);
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
+
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), pFilePart);
+
#endif
hFile = FindFirstFile
(szFullPath, &f);
@@ -249,13 +268,18 @@
_tcscpy (pFilePart,
f.cFileName);
#ifdef _DEBUG
- ConErrPrintf (_T("Full
filename: %s\n"), szFullPath);
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR4, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
+
#endif
/* ask for deleting */
if (dwFlags &
DEL_PROMPT)
- {
- ConErrPrintf
(_T("The file %s will be deleted! "), szFullPath);
- res =
FilePromptYN (_T("Are you sure (Y/N)?"));
+ {
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR5, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg),
szFullPath);
+
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR6, (LPTSTR) szMsg,sizeof(szMsg));
+ res =
FilePromptYN (_T((LPTSTR)szMsg));
if ((res ==
PROMPT_NO) || (res == PROMPT_BREAK))
{
@@ -264,7 +288,10 @@
}
if (!(dwFlags &
DEL_QUIET) && !(dwFlags & DEL_TOTAL))
- ConErrPrintf
(_T("Deleting: %s\n"), szFullPath);
+ {
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR7, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg),
szFullPath);
+ }
/* delete the file */
if (!(dwFlags &
DEL_NOTHING))
@@ -307,7 +334,8 @@
{
/* no wildcards in filespec */
#ifdef _DEBUG
- ConErrPrintf (_T("No
Wildcards!\n"));
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR8, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
#endif
GetFullPathName (arg[i],
MAX_PATH,
@@ -317,8 +345,11 @@
/*ask for deleting */
if((dwFlags & DEL_PROMPT) &&
(FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE)) //Don't ask if
the file doesn't exist, the following code will make the error-msg
{
- ConErrPrintf (_T("The
file %s will be deleted! "), szFullPath);
- res = FilePromptYN
(_T("Are you sure (Y/N)?"));
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR5, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
+
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR6, (LPTSTR) szMsg,sizeof(szMsg));
+ res = FilePromptYN
(_T((LPTSTR)szMsg));
if ((res == PROMPT_NO)
|| (res == PROMPT_BREAK))
{
@@ -327,10 +358,14 @@
}
#ifdef _DEBUG
- ConErrPrintf (_T("Full path:
%s\n"), szFullPath);
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
#endif
if (!(dwFlags & DEL_QUIET) &&
!(dwFlags & DEL_TOTAL))
- ConOutPrintf
(_T("Deleting %s\n"), szFullPath);
+ {
+ LoadString(
GetModuleHandle(NULL), STRING_DEL_ERROR7, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
+ }
if (!(dwFlags & DEL_NOTHING))
{
@@ -380,12 +415,16 @@
if (!(dwFlags & DEL_QUIET))
{
- if (dwFiles == 0)
- ConOutPrintf (_T(" 0 files deleted\n"));
+ if (dwFiles < 2)
+ {
+ LoadString( GetModuleHandle(NULL), STRING_DEL_HELP3,
(LPTSTR) szMsg,sizeof(szMsg));
+ }
else
- ConOutPrintf (_T(" %lu file%s deleted\n"),
- dwFiles,
- (dwFiles == 1) ? _T("") :
_T("s"));
+ {
+ LoadString( GetModuleHandle(NULL), STRING_DEL_HELP4,
(LPTSTR) szMsg,sizeof(szMsg));
+ }
+
+ ConOutPrintf (_T((LPTSTR)szMsg), dwFiles);
}
return 0;
_____
Modified: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/resource.h 2005-04-03 13:04:10 UTC
(rev 14475)
+++ trunk/reactos/subsys/system/cmd/resource.h 2005-04-03 13:40:15 UTC
(rev 14476)
@@ -2,8 +2,8 @@
#define STRING_CHOICE_OPTION 200
#define STRING_COPY_OPTION 201
+#define STRING_DEL_OPTION 202
-
#define STRING_ALIAS_ERROR 300
#define STRING_BATCH_ERROR 301
#define STRING_CHCP_ERROR1 302
@@ -18,13 +18,25 @@
#define STRING_CMD_ERROR3 311
#define STRING_CMD_ERROR4 312
#define STRING_CMD_ERROR5 313
-#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_COLOR_ERROR1 314
+#define STRING_COLOR_ERROR2 315
+#define STRING_COLOR_ERROR3 316
+#define STRING_COLOR_ERROR4 317
+#define STRING_CONSOLE_ERROR 318
+#define STRING_COPY_ERROR1 319
+#define STRING_COPY_ERROR2 320
+#define STRING_COPY_ERROR3 321
+#define STRING_COPY_ERROR4 322
+#define STRING_DATE_ERROR 323
+#define STRING_DEL_ERROR1 324
+#define STRING_DEL_ERROR2 325
+#define STRING_DEL_ERROR3 326
+#define STRING_DEL_ERROR4 327
+#define STRING_DEL_ERROR5 328
+#define STRING_DEL_ERROR6 329
+#define STRING_DEL_ERROR7 330
+#define STRING_DEL_ERROR8 331
+#define STRING_PARAM_ERROR 332
#define STRING_ATTRIB_HELP 400
#define STRING_ALIAS_HELP 401
@@ -49,10 +61,14 @@
#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
+#define STRING_DEL_HELP1 423
+#define STRING_DEL_HELP2 424
+#define STRING_DEL_HELP3 425
+#define STRING_DEL_HELP4 426
+#define STRING_EXIT_HELP 427
+#define STRING_MKDIR_HELP 428
+#define STRING_RMDIR_HELP 429
+#define STRING_REM_HELP 430