Remove all hardcode string to En.rc
from free.c, goto.c, if.c label.c
Modified: trunk/reactos/subsys/system/cmd/En.rc
Modified: trunk/reactos/subsys/system/cmd/free.c
Modified: trunk/reactos/subsys/system/cmd/goto.c
Modified: trunk/reactos/subsys/system/cmd/if.c
Modified: trunk/reactos/subsys/system/cmd/label.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-28 20:26:06 UTC
(rev 14849)
+++ trunk/reactos/subsys/system/cmd/En.rc 2005-04-28 21:17:07 UTC
(rev 14850)
@@ -239,7 +239,42 @@
To user the FOR comamnd in a batch program, specify %%variable instead
of\n \
%variable."
+STRING_FREE_HELP1, "\n Volume in drive %s is %-11s Serial number is
%s\n \
+ %16s bytes total disk space\n \
+ %16s bytes used\n \
+ %16s bytes free\n"
+STRING_FREE_HELP2, "Displays drive information.\n\nFREE [drive: ...]"
+
+STRING_IF_HELP1, "Performs conditional processing in batch
programs.\n\n \
+ IF [NOT] ERRORLEVEL number command\n \
+ IF [NOT] string1==string2 command\n \
+ IF [NOT] EXIST filename command\n \
+ IF [NOT] DEFINED variable command\n\n \
+NOT Specifies that CMD should carry out the command only
if\n \
+ the condition is false\n \
+ERRORLEVEL number Specifies a true condition if the last program run
returned\n \
+ an exit code equal or greater than the number
specified.\n \
+command Specifies the command to carry out if the condition
is met.\n \
+string1==string2 Specifies a true condition if the specified text
strings\n \
+ match.\n \
+EXIST filename Specifies a true condition if the specified filename
exists.\n \
+DEFINED variable Specifies a true condition if the specified variable
is\n \
+ defined."
+
+STRING_GOTO_HELP1, "Directs CMD to a labeled line in a batch
script.\n\n \
+GOTO label\n\n \
+ label Specifies a text string used in a batch script as a label.\n\n
\
+You type a label on a line by itself, beginning with a colon."
+
+STRING_LABEL_HELP1, "Displays or changes drive label.\n\nLABEL
[drive:][label]"
+
+STRING_LABEL_HELP2, "Volume in drive %c: is %s\n"
+STRING_LABEL_HELP3, "Volume in drive %c: has no label\n"
+STRING_LABEL_HELP4, "Volume Serial Number is %04X-%04X\n"
+STRING_LABEL_HELP5, "Drive label (11 Characters, ENTER if none)? "
+
+
STRING_MKDIR_HELP, "Creates a directory.\n\n \
MKDIR [drive:]path\nMD [drive:]path"
@@ -293,16 +328,17 @@
STRING_DEL_ERROR8, "No Wildcards!\n"
STRING_ERROR_ERROR1, "Unknown error! Error code: 0x%lx\n"
STRING_ERROR_ERROR2, "Syntax error"
-STRING_FOR_ERROR1, "'in' missing in for statement."
-STRING_FOR_ERROR2, "no brackets found."
-STRING_FOR_ERROR3, "'do' missing."
-STRING_FOR_ERROR4, "no command after 'do'."
-STRING_FREE_ERROR1, "Invalid drive"
-STRING_FREE_ERROR2, "unlabeled"
+STRING_FOR_ERROR1, "'in' missing in for statement."
+STRING_FOR_ERROR2, "no brackets found."
+STRING_FOR_ERROR3, "'do' missing."
+STRING_FOR_ERROR4, "no command after 'do'."
+STRING_FREE_ERROR1, "Invalid drive"
+STRING_FREE_ERROR2, "unlabeled"
+STRING_GOTO_ERROR1, "No label specified for GOTO"
+STRING_GOTO_ERROR2, "Label '%s' not found\n"
STRING_PARAM_ERROR, "Required parameter missing\n"
-
STRING_ERROR_PARAMETERF_ERROR, "Parameter format not correct - %c\n"
STRING_ERROR_INVALID_SWITCH, "Invalid switch - /%c\n"
STRING_ERROR_TOO_MANY_PARAMETERS, "Too many parameters - %s\n"
_____
Modified: trunk/reactos/subsys/system/cmd/free.c
--- trunk/reactos/subsys/system/cmd/free.c 2005-04-28 20:26:06 UTC
(rev 14849)
+++ trunk/reactos/subsys/system/cmd/free.c 2005-04-28 21:17:07 UTC
(rev 14850)
@@ -6,9 +6,13 @@
*
* 01-Sep-1999 (Eric Kohl)
* Started.
+ *
+ * 28-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_FREE
@@ -67,10 +71,14 @@
DWORD dwBytPerSec;
DWORD dwFreeCl;
DWORD dwTotCl;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':'))
{
- ConErrPrintf (_T("Invalid drive %s\n"), szDisk);
+
+ LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf ((LPTSTR)szMsg);
+
return;
}
@@ -80,12 +88,17 @@
if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial,
NULL, NULL, NULL, 0))
{
- ConErrPrintf (_T("Invalid drive %s:\n"), szDrive);
+ LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T("%s %s:\n"),(LPTSTR)szMsg, szDrive);
return;
}
if (szVolume[0] == _T('\0'))
- _tcscpy (szVolume, _T("unlabeled"));
+ {
+
+ LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR2,
(LPTSTR) szMsg,sizeof(szMsg));
+ _tcscpy (szVolume, (LPTSTR) szMsg);
+ }
_stprintf (szSerial,
_T("%04X-%04X"),
@@ -95,7 +108,8 @@
if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl,
&dwBytPerSec, &dwFreeCl, &dwTotCl))
{
- ConErrPrintf (_T("Invalid drive %s:\n"), szDrive);
+ LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConErrPrintf (_T("%s %s:\n"),(LPTSTR)szMsg, szDrive);
return;
}
@@ -108,13 +122,9 @@
uliSize.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
ConvertULargeInteger (uliSize, szFree, 40);
- ConOutPrintf (_T("\n"
- " Volume in drive %s is %-11s Serial number
is %s\n"
- " %16s bytes total disk space\n"
- " %16s bytes used\n"
- " %16s bytes free\n"),
- szDrive, szVolume, szSerial,
- szTotal, szUsed, szFree);
+
+ LoadString( GetModuleHandle(NULL), STRING_FREE_HELP1, (LPTSTR)
szMsg,sizeof(szMsg));
+ ConOutPrintf ((LPTSTR)szMsg,szDrive, szVolume, szSerial,szTotal,
szUsed, szFree);
}
@@ -124,12 +134,13 @@
TCHAR szDefPath[MAX_PATH];
INT argc, i;
LPTSTR *arg;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Displays drive information.\n"
- "\n"
- "FREE [drive: ...]"));
+ LoadString( GetModuleHandle(NULL), STRING_FREE_HELP2,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts ((LPTSTR)szMsg);
+
return 0;
}
_____
Modified: trunk/reactos/subsys/system/cmd/goto.c
--- trunk/reactos/subsys/system/cmd/goto.c 2005-04-28 20:26:06 UTC
(rev 14849)
+++ trunk/reactos/subsys/system/cmd/goto.c 2005-04-28 21:17:07 UTC
(rev 14850)
@@ -21,9 +21,13 @@
*
* 27-Jan-1999 (Eric Kohl <ekohl(a)abo.rhein-zeitung.de>)
* Added help text ("/?").
+ *
+ * 28-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
/*
@@ -37,6 +41,7 @@
{
LPTSTR tmp;
LONG lNewPosHigh;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef _DEBUG
DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
@@ -44,13 +49,9 @@
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Directs CMD to a labeled line in a batch
script.\n"
- "\n"
- "GOTO label\n"
- "\n"
- " label Specifies a text
string used in a batch script as a label.\n"
- "\n"
- "You type a label on a line
by itself, beginning with a colon."));
+ LoadString( GetModuleHandle(NULL), STRING_GOTO_HELP1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts ((LPTSTR)szMsg);
+
return 0;
}
@@ -62,7 +63,9 @@
if (*param == _T('\0'))
{
- ExitBatch (_T("No label specified for GOTO\n"));
+
+ LoadString( GetModuleHandle(NULL), STRING_GOTO_ERROR1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ExitBatch ((LPTSTR)szMsg);
return 1;
}
@@ -94,7 +97,8 @@
return 0;
}
- ConErrPrintf (_T("Label '%s' not found\n"), param);
+ LoadString( GetModuleHandle(NULL), STRING_GOTO_ERROR2, (LPTSTR)
szMsg,sizeof(szMsg));
+ ConErrPrintf ((LPTSTR)szMsg,param);
ExitBatch (NULL);
return 1;
_____
Modified: trunk/reactos/subsys/system/cmd/if.c
--- trunk/reactos/subsys/system/cmd/if.c 2005-04-28 20:26:06 UTC
(rev 14849)
+++ trunk/reactos/subsys/system/cmd/if.c 2005-04-28 21:17:07 UTC
(rev 14850)
@@ -24,9 +24,14 @@
*
* 17-Feb-2001 (ea)
* IF DEFINED variable command
+ *
+ * 28-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
+ *
*/
#include "precomp.h"
+#include "resource.h"
#define X_EXEC 1
@@ -36,6 +41,7 @@
{
INT x_flag = 0; /* when set cause 'then' clause to be executed
*/
LPTSTR pp;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef _DEBUG
DebugPrintf (_T("cmd_if: (\'%S\', \'%S\')\n"), cmd, param);
@@ -43,23 +49,8 @@
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Performs conditional processing in batch
programs.\n"
- "\n"
- " IF [NOT] ERRORLEVEL number command\n"
- " IF [NOT] string1==string2 command\n"
- " IF [NOT] EXIST filename command\n"
- " IF [NOT] DEFINED variable command\n"
- "\n"
- "NOT Specifies that CMD
should carry out the command only if\n"
- " the condition is
false\n"
- "ERRORLEVEL number Specifies a true
condition if the last program run returned\n"
- " an exit code equal or
greater than the number specified.\n"
- "command Specifies the command
to carry out if the condition is met.\n"
- "string1==string2 Specifies a true
condition if the specified text strings\n"
- " match.\n"
- "EXIST filename Specifies a true
condition if the specified filename exists.\n"
- "DEFINED variable Specifies a true
condition if the specified variable is\n"
- " defined."));
+ LoadString( GetModuleHandle(NULL), STRING_IF_HELP1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPuts((LPTSTR)szMsg);
return 0;
}
_____
Modified: trunk/reactos/subsys/system/cmd/label.c
--- trunk/reactos/subsys/system/cmd/label.c 2005-04-28 20:26:06 UTC
(rev 14849)
+++ trunk/reactos/subsys/system/cmd/label.c 2005-04-28 21:17:07 UTC
(rev 14850)
@@ -12,9 +12,13 @@
*
* 19-Jan-1998 (Eric Kohl <ekohl(a)abo.rhein-zeitung.de>)
* Unicode ready!
+ *
+ * 28-Apr-2005 (Magnus Olsen) <magnus(a)greatlord.com>)
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
+#include "resource.h"
#ifdef INCLUDE_CMD_LABEL
@@ -27,6 +31,7 @@
DWORD dwSerialNr;
LPTSTR *arg;
INT args;
+ WCHAR szMsg[RC_STRING_MAX_SIZE];
/* set empty label string */
szLabel[0] = _T('\0');
@@ -34,8 +39,9 @@
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts (_T("Displays or changes drive label.\n\n"
- "LABEL [drive:][label]"));
+ LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP1,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf ((LPTSTR)szMsg);
+
return 0;
}
@@ -85,21 +91,29 @@
GetVolumeInformation (szRootPath, szOldLabel, 80, &dwSerialNr,
NULL, NULL, NULL, 0);
- /* print drive info */
- ConOutPrintf (_T("Volume in drive %c:"), _totupper
(szRootPath[0]));
-
+ /* print drive info */
if (szOldLabel[0] != _T('\0'))
- ConOutPrintf (_T(" is %s\n"), szOldLabel);
+ {
+ LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP2,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf ((LPTSTR) szMsg, _totupper (szRootPath[0]),
szOldLabel);
+ }
else
- ConOutPrintf (_T(" has no label\n"));
+ {
+ LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP3,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf ((LPTSTR) szMsg, _totupper
(szRootPath[0]));
+ }
+
+
/* print the volume serial number */
- ConOutPrintf (_T("Volume Serial Number is %04X-%04X\n"),
- HIWORD(dwSerialNr),
LOWORD(dwSerialNr));
+ LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP4, (LPTSTR)
szMsg,sizeof(szMsg));
+ ConOutPrintf ((LPTSTR)szMsg, HIWORD(dwSerialNr),
LOWORD(dwSerialNr));
if (szLabel[0] == _T('\0'))
{
- ConOutPrintf (_T("Drive label (11 Characters, ENTER if
none)? "));
+ LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP5,
(LPTSTR) szMsg,sizeof(szMsg));
+ ConOutPrintf ((LPTSTR)szMsg);
+
ConInString (szLabel, 80);
}
_____
Modified: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/resource.h 2005-04-28 20:26:06 UTC
(rev 14849)
+++ trunk/reactos/subsys/system/cmd/resource.h 2005-04-28 21:17:07 UTC
(rev 14850)
@@ -59,7 +59,9 @@
#define STRING_FOR_ERROR4 337
#define STRING_FREE_ERROR1 338
#define STRING_FREE_ERROR2 339
-#define STRING_PARAM_ERROR 340
+#define STRING_GOTO_ERROR1 340
+#define STRING_GOTO_ERROR2 341
+#define STRING_PARAM_ERROR 342
#define STRING_ATTRIB_HELP 600
@@ -115,12 +117,27 @@
#define STRING_FOR_HELP1 646
-#define STRING_MKDIR_HELP 647
-#define STRING_RMDIR_HELP 648
-#define STRING_REM_HELP 649
+#define STRING_FREE_HELP1 647
+#define STRING_FREE_HELP2 648
+#define STRING_IF_HELP1 650
+#define STRING_GOTO_HELP1 651
+#define STRING_LABEL_HELP1 652
+#define STRING_LABEL_HELP2 653
+#define STRING_LABEL_HELP3 654
+#define STRING_LABEL_HELP4 655
+#define STRING_LABEL_HELP5 656
+
+#define STRING_MKDIR_HELP 657
+
+#define STRING_RMDIR_HELP 658
+
+#define STRING_REM_HELP 659
+
+
+