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/console.c
Modified: trunk/reactos/subsys/system/cmd/copy.c
Modified: trunk/reactos/subsys/system/cmd/date.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 10:05:52 UTC
(rev 14466)
+++ trunk/reactos/subsys/system/cmd/En.rc 2005-04-03 10:16:56 UTC
(rev 14467)
@@ -86,7 +86,54 @@
(cannot be terminated).\n \
/T:bf Sets the background/foreground color (see COLOR
command)."
+STRING_COLOR_HELP1, "Sets the default foreground and background
colors.\n\n \
+COLOR [attr [/F]] \n\n \
+ attr Specifies color attribute of console output\n \
+ /F fill the console with color attribute\n\n \
+There are three ways to specify the colors:\n \
+1) [bright] name on [bright] name (only the first three letters are
required)\n \
+2) decimal on decimal\n \
+3) two hex digits\n\n \
+Colors are:\n \
+dec hex name dec hex name\n \
+0 0 Black 8 8 Gray(Bright black)\n \
+1 1 Blue 9 9 Bright Blue\n \
+2 2 Green 10 A Bright Green\n \
+3 3 Cyan 11 B Bright Cyan\n \
+4 4 Red 12 C Bright Red\n \
+5 5 Magenta 13 D Bright Magenta\n \
+6 6 Yellow 14 E Bright Yellow\n \
+7 7 White 15 F Bright White"
+STRING_COPY_HELP1, "Overwrite %s (Yes/No/All)? "
+
+STRING_COPY_HELP2, "Copies one or more files to another location.\n\n \
+COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n \
+ [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n \
+ source Specifies the file or files to be copied.\n \
+ /A Indicates an ASCII text file.\n \
+ /B Indicates a binary file.\n \
+ destination Specifies the directory and/or filename for the new
file(s).\n \
+ /V Verifies that new files are written correctly.\n \
+ /Y Suppresses prompting to confirm you want to overwrite
an\n \
+ existing destination file.\n \
+ /-Y Causes prompting to confirm you want to overwrite an\n \
+ existing destination file.\n\n \
+The switch /Y may be present in the COPYCMD environment variable.\n \
+..."
+
+STRING_DATE_HELP1, "\nEnter new date (mm%cdd%cyyyy): "
+
+STRING_DATE_HELP2, "\nEnter new date (dd%cmm%cyyyy): "
+
+STRING_DATE_HELP3, "\nEnter new date (yyyy%cmm%cdd): "
+
+STRING_DATE_HELP4, "Displays or sets the date.\n\n \
+DATE [/T][date]\n\n \
+ /T display only\n\n \
+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_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"
STRING_MKDIR_HELP, "Creates a directory.\n\n \
@@ -103,10 +150,10 @@
+STRING_CHOICE_OPTION, "YN"
+STRING_COPY_OPTION, "YNA"
-STRING_CHOICE_OPTION "YN"
-
STRING_ALIAS_ERROR, "Command line too long after alias
expansion!\n"
STRING_BATCH_ERROR, "Error opening batch file\n"
STRING_CHCP_ERROR1, "Active code page: %u\n"
@@ -121,6 +168,12 @@
STRING_CMD_ERROR3, "Can't redirect to file %s\n"
STRING_CMD_ERROR4, "Running %s...\n"
STRING_CMD_ERROR5, "Running cmdexit.bat...\n"
+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_PARAM_ERROR, "Required parameter missing\n"
_____
Modified: trunk/reactos/subsys/system/cmd/color.c
--- trunk/reactos/subsys/system/cmd/color.c 2005-04-03 10:05:52 UTC
(rev 14466)
+++ trunk/reactos/subsys/system/cmd/color.c 2005-04-03 10:16:56 UTC
(rev 14467)
@@ -16,44 +16,23 @@
*
* 14-Oct-1999 (Paolo Pantaleo <paolopan(a)freemail.it>)
* 4nt's syntax implemented
+ *
+ * 03-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_COLOR
static VOID ColorHelp (VOID)
{
- ConOutPuts (_T(
- "Sets the default foreground and background
colors.\n"
- "\n"
- "COLOR [attr [/F]] \n\n"
- " attr Specifies color attribute of
console output\n"
- " /F fill the console with color
attribute\n"
- "\n"
- "There are three ways to specify the colors:"
- ));
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+ LoadString( GetModuleHandle(NULL), STRING_COLOR_HELP1, (LPTSTR)
szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
- ConOutPuts (_T(
- "\n"
- "1) [bright] name on [bright] name (only the
first three letters are required)\n"
- "2) decimal on decimal\n"
- "3) two hex digits\n"
- "\n"
- "Colors are:"
- ));
-
- ConOutPuts (_T(
- "dec hex name dec hex name\n"
- "0 0 Black 8 8 Gray(Bright
black)\n"
- "1 1 Blue 9 9 Bright Blue\n"
- "2 2 Green 10 A Bright Green\n"
- "3 3 Cyan 11 B Bright Cyan\n"
- "4 4 Red 12 C Bright Red\n"
- "5 5 Magenta 13 D Bright
Magenta\n"
- "6 6 Yellow 14 E Bright Yellow\n"
- "7 7 White 15 F Bright White"));
}
_____
Modified: trunk/reactos/subsys/system/cmd/console.c
--- trunk/reactos/subsys/system/cmd/console.c 2005-04-03 10:05:52 UTC
(rev 14466)
+++ trunk/reactos/subsys/system/cmd/console.c 2005-04-03 10:16:56 UTC
(rev 14467)
@@ -7,9 +7,13 @@
*
* 20-Jan-1999 (Eric Kohl <ekohl(a)abo.rhein-zeitung.de>)
* started
+ *
+ * 03-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#define OUTPUT_BUFFER_SIZE 4096
@@ -210,6 +214,7 @@
DWORD ret;
LPTSTR text;
va_list arg_ptr;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
va_start (arg_ptr, MessageId);
ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
@@ -228,7 +233,8 @@
}
else
{
- ConErrPrintf (_T("Unknown error: %d\n"), MessageId);
+ LoadString( GetModuleHandle(NULL), STRING_CONSOLE_ERROR,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
}
}
_____
Modified: trunk/reactos/subsys/system/cmd/copy.c
--- trunk/reactos/subsys/system/cmd/copy.c 2005-04-03 10:05:52 UTC
(rev 14466)
+++ trunk/reactos/subsys/system/cmd/copy.c 2005-04-03 10:16:56 UTC
(rev 14467)
@@ -20,9 +20,13 @@
*
* 27-Oct-1998 (Eric Kohl <ekohl(a)abo.rhein-zeitung.de>)
* Disabled prompting when used in batch mode.
+ *
+ * 03-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_COPY
@@ -294,8 +298,17 @@
{
TCHAR inp[10];
LPTSTR p;
+
+ LPTSTR lpOptions;
+ TCHAR Options[3];
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
- ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn);
+ LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR)
Options,sizeof(lpOptions));
+ lpOptions = _T(Options);
+
+ LoadString( GetModuleHandle(NULL), STRING_COPY_HELP1, (LPTSTR)
szMsg,sizeof(szMsg));
+ ConOutPrintf (_T((LPTSTR)szMsg));
+
ConInString (inp, 10);
ConOutPuts (_T(""));
@@ -303,9 +316,9 @@
for (p = inp; _istspace (*p); p++)
;
- if (*p != _T('Y') && *p != _T('A'))
+ if (*p != lpOptions[0] && *p != lpOptions[2])
return 0;
- if (*p == _T('A'))
+ if (*p == lpOptions[2])
return 2;
return 1;
@@ -326,6 +339,7 @@
DWORD dwWritten;
DWORD i;
BOOL bEof = FALSE;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef _DEBUG
DebugPrintf (_T("checking mode\n"));
@@ -337,7 +351,8 @@
NULL, OPEN_EXISTING,
0, NULL);
if (hFileSrc == INVALID_HANDLE_VALUE)
{
- ConErrPrintf (_T("Error: Cannot open source - %s!\n"),
source);
+ LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), source);
return 0;
}
@@ -364,7 +379,9 @@
{
if (!_tcscmp (dest, source))
{
- ConErrPrintf (_T("Error: Can't copy onto
itself!\n"));
+ LoadString( GetModuleHandle(NULL),
STRING_COPY_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg), source);
+
CloseHandle (hFileSrc);
return 0;
}
@@ -438,7 +455,10 @@
WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL);
if (dwWritten != dwRead)
{
- ConErrPrintf (_T("Error writing
destination!\n"));
+
+ LoadString( GetModuleHandle(NULL),
STRING_COPY_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
+
free (buffer);
CloseHandle (hFileDest);
CloseHandle (hFileSrc);
@@ -618,6 +638,7 @@
TCHAR dir_d[_MAX_DIR];
TCHAR file_d[_MAX_FNAME];
TCHAR ext_d[_MAX_EXT];
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
int argc;
int append;
@@ -634,23 +655,8 @@
if (!_tcsncmp (rest, _T("/?"), 2))
{
- ConOutPuts (_T("Copies one or more files to another
location.\n"
- "\n"
- "COPY [/V][/Y|/-Y][/A|/B]
source [/A|/B]\n"
- " [+ source [/A|/B] [+
...]] [destination [/A|/B]]\n"
- "\n"
- " source Specifies the
file or files to be copied.\n"
- " /A Indicates an
ASCII text file.\n"
- " /B Indicates a
binary file.\n"
- " destination Specifies the
directory and/or filename for the new file(s).\n"
- " /V Verifies that
new files are written correctly.\n"
- " /Y Suppresses
prompting to confirm you want to overwrite an\n"
- " existing
destination file.\n"
- " /-Y Causes
prompting to confirm you want to overwrite an\n"
- " existing
destination file.\n"
- "\n"
- "The switch /Y may be present
in the COPYCMD environment variable.\n"
- "..."));
+ LoadString( GetModuleHandle(NULL), STRING_COPY_HELP2,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
return 1;
}
@@ -722,7 +728,9 @@
}
else if (bDestFound && bWildcards)
{
- ConErrPrintf (_T("Error: Not implemented yet!\n"));
+ LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR4,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T((LPTSTR)szMsg));
+
DeleteFileList (sources);
freep (p);
return 0;
_____
Modified: trunk/reactos/subsys/system/cmd/date.c
--- trunk/reactos/subsys/system/cmd/date.c 2005-04-03 10:05:52 UTC
(rev 14466)
+++ trunk/reactos/subsys/system/cmd/date.c 2005-04-03 10:16:56 UTC
(rev 14467)
@@ -26,9 +26,13 @@
*
* 04-Feb-1999 (Eric Kohl <ekohl(a)abo.rhein-zeitung.de>)
* Fixed date input bug.
+ *
+ * 03-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_DATE
@@ -43,22 +47,24 @@
static VOID
PrintDateString (VOID)
{
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
+
switch (nDateFormat)
{
case 0: /* mmddyy */
default:
- ConOutPrintf (_T("\nEnter new date
(mm%cdd%cyyyy): "),
- cDateSeparator, cDateSeparator);
+ LoadString( GetModuleHandle(NULL),
STRING_DATE_HELP1, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator,
cDateSeparator);
break;
case 1: /* ddmmyy */
- ConOutPrintf (_T("\nEnter new date
(dd%cmm%cyyyy): "),
- cDateSeparator,
cDateSeparator);
+ LoadString( GetModuleHandle(NULL),
STRING_DATE_HELP2, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator,
cDateSeparator);
break;
case 2: /* yymmdd */
- ConOutPrintf (_T("\nEnter new date
(yyyy%cmm%cdd): "),
- cDateSeparator,
cDateSeparator);
+ LoadString( GetModuleHandle(NULL),
STRING_DATE_HELP3, (LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf (_T((LPTSTR)szMsg), cDateSeparator,
cDateSeparator);
break;
}
}
@@ -183,14 +189,12 @@
INT i;
BOOL bPrompt = TRUE;
INT nDateString = -1;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Displays or sets the date.\n\n"
- "DATE [/T][date]\n\n"
- " /T display only\n\n"
- "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."));
+ LoadString( GetModuleHandle(NULL), STRING_DATE_HELP4,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts (_T((LPTSTR)szMsg));
return 0;
}
@@ -243,7 +247,9 @@
freep (arg);
return 0;
}
- ConErrPuts (_T("Invalid date."));
+ LoadString( GetModuleHandle(NULL), STRING_DATE_ERROR,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPuts (_T((LPTSTR)szMsg));
+
}
freep (arg);
_____
Modified: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/resource.h 2005-04-03 10:05:52 UTC
(rev 14466)
+++ trunk/reactos/subsys/system/cmd/resource.h 2005-04-03 10:16:56 UTC
(rev 14467)
@@ -1,6 +1,7 @@
#define RC_STRING_MAX_SIZE 2048
#define STRING_CHOICE_OPTION 200
+#define STRING_COPY_OPTION 201
#define STRING_ALIAS_ERROR 300
@@ -17,7 +18,13 @@
#define STRING_CMD_ERROR3 311
#define STRING_CMD_ERROR4 312
#define STRING_CMD_ERROR5 313
-#define STRING_PARAM_ERROR 314
+#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_ATTRIB_HELP 400
#define STRING_ALIAS_HELP 401
@@ -35,10 +42,17 @@
#define STRING_CMD_HELP6 413
#define STRING_CMD_HELP7 414
#define STRING_CMD_HELP8 415
-#define STRING_EXIT_HELP 416
-#define STRING_MKDIR_HELP 417
-#define STRING_RMDIR_HELP 418
-#define STRING_REM_HELP 419
+#define STRING_COLOR_HELP1 416
+#define STRING_COPY_HELP1 417
+#define STRING_COPY_HELP2 418
+#define STRING_DATE_HELP1 419
+#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