mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Remove all hardcode string to En.rc
from echo.c and error.c svn path=/trunk/; revision=14847
This commit is contained in:
parent
9e858b535b
commit
5571662474
4 changed files with 161 additions and 56 deletions
|
@ -6,6 +6,7 @@
|
|||
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
|
||||
STRING_ATTRIB_HELP, "Displays or changes file attributes.\n\n \
|
||||
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n \
|
||||
[/S [/D]]\n\n \
|
||||
|
@ -209,6 +210,24 @@ STRING_DIRSTACK_HELP3, "Prints the contents of the directory stack.\n\nDIRS"
|
|||
|
||||
STRING_DIRSTACK_HELP4, "Directory stack empty"
|
||||
|
||||
STRING_ECHO_HELP1, "Display a messages without trailing carridge return and line feed.\n\n \
|
||||
ECHOS message"
|
||||
|
||||
STRING_ECHO_HELP2, "Displays a message to the standard error.\n\n \
|
||||
ECHOERR message\n \
|
||||
ECHOERR. prints an empty line"
|
||||
|
||||
STRING_ECHO_HELP3, "Prints a messages to standard error output without trailing carridge return and line feed.\n\n \
|
||||
ECHOSERR message"
|
||||
|
||||
STRING_ECHO_HELP4, "Displays a message or switches command echoing on or off.\n\n \
|
||||
ECHO [ON | OFF]\n \
|
||||
ECHO [message]\n \
|
||||
ECHO. prints an empty line\n\n \
|
||||
Type ECHO without a parameter to display the current ECHO setting."
|
||||
|
||||
STRING_ECHO_HELP5, "ECHO is %s\n"
|
||||
|
||||
|
||||
STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"
|
||||
|
||||
|
@ -225,11 +244,6 @@ STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
STRING_CHOICE_OPTION, "YN"
|
||||
STRING_COPY_OPTION, "YNA"
|
||||
STRING_DEL_OPTION, "AENPQSTWXYZ"
|
||||
|
@ -267,7 +281,24 @@ 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_ERROR_ERROR1, "Unknown error! Error code: 0x%lx\n"
|
||||
STRING_ERROR_ERROR2, "Syntax error"
|
||||
|
||||
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"
|
||||
STRING_ERROR_PATH_NOT_FOUND, "Path not found\n"
|
||||
STRING_ERROR_FILE_NOT_FOUND, "File not found\n"
|
||||
STRING_ERROR_REQ_PARAM_MISSING, "Required parameter missing\n"
|
||||
STRING_ERROR_INVALID_DRIVE, "Invalid drive specification\n"
|
||||
STRING_ERROR_INVALID_PARAM_FORMAT, "Invalid parameter format - %s\n"
|
||||
STRING_ERROR_BADCOMMAND, "Bad command or filename\n"
|
||||
STRING_ERROR_OUT_OF_MEMORY, "Out of memory error.\n"
|
||||
STRING_ERROR_CANNOTPIPE, "Error! Cannot pipe! Cannot open temporary file!\n"
|
||||
STRING_ERROR_D_PAUSEMSG, "Press any key to continue . . ."
|
||||
STRING_ERROR_DRIVER_NOT_READY "Drive not ready"
|
||||
|
||||
}
|
||||
|
|
|
@ -22,26 +22,27 @@
|
|||
*
|
||||
* 13-Jul-2000 (Eric Kohl <ekohl@rz-online.de>)
|
||||
* Implemented 'echo.' and 'echoerr.'.
|
||||
*
|
||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
||||
* Remove all hardcode string to En.rc
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutPuts (_T("Displays a message or switches command echoing on or off.\n"
|
||||
"\n"
|
||||
" ECHO [ON | OFF]\n"
|
||||
" ECHO [message]\n"
|
||||
" ECHO. prints an empty line\n"
|
||||
"\n"
|
||||
"Type ECHO without a parameter to display the current ECHO setting."));
|
||||
LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP4, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPuts (_T((LPTSTR)szMsg));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -60,8 +61,10 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
|||
bEcho = TRUE;
|
||||
else if (*param)
|
||||
ConOutPuts (param);
|
||||
else
|
||||
ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF);
|
||||
else {
|
||||
LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP4, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPrintf (_T((LPTSTR)szMsg), bEcho ? D_ON : D_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -69,15 +72,17 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutPuts (_T("Display a messages without trailing carridge return and line feed.\n"
|
||||
"\n"
|
||||
" ECHOS message"));
|
||||
LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP1, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPuts(_T((LPTSTR)szMsg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -90,16 +95,17 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutPuts (_T("Displays a message to the standard error.\n"
|
||||
"\n"
|
||||
" ECHOERR message\n"
|
||||
" ECHOERR. prints an empty line"));
|
||||
LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP2, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPuts(_T((LPTSTR)szMsg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -120,15 +126,19 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutPuts (_T("Prints a messages to standard error output without trailing carridge return and line feed.\n"
|
||||
"\n"
|
||||
" ECHOSERR message"));
|
||||
LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP3, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPuts(_T((LPTSTR)szMsg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,15 @@
|
|||
*
|
||||
* 02-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
||||
* Use FormatMessage() for error reports.
|
||||
*
|
||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
||||
* Remove all hardcode string to En.rc
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
/*
|
||||
#define PARAMETERF_ERROR _T("Parameter format not correct - %c\n")
|
||||
#define INVALID_SWITCH _T("Invalid switch - /%c\n")
|
||||
#define TOO_MANY_PARAMETERS _T("Too many parameters - %s\n")
|
||||
|
@ -33,14 +37,17 @@
|
|||
#define CANNOTPIPE _T("Error! Cannot pipe! Cannot open temporary file!\n")
|
||||
|
||||
#define D_PAUSEMSG _T("Press any key to continue . . .")
|
||||
|
||||
*/
|
||||
|
||||
|
||||
VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
||||
{
|
||||
TCHAR szMessage[1024];
|
||||
#ifndef __REACTOS__
|
||||
LPTSTR szError;
|
||||
#endif
|
||||
va_list arg_ptr;
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
if (dwErrorCode == ERROR_SUCCESS)
|
||||
return;
|
||||
|
@ -64,7 +71,8 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
}
|
||||
else
|
||||
{
|
||||
ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode);
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg), dwErrorCode);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -73,111 +81,143 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
switch (dwErrorCode)
|
||||
{
|
||||
case ERROR_FILE_NOT_FOUND:
|
||||
szError = _T("File not found");
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
break;
|
||||
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
szError = _T("Path not found");
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
break;
|
||||
|
||||
case ERROR_NOT_READY:
|
||||
szError = _T("Drive not ready");
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_DRIVER_NOT_READY, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
break;
|
||||
|
||||
default:
|
||||
ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode);
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
return;
|
||||
}
|
||||
|
||||
if (szFormat)
|
||||
ConErrPrintf (_T("%s -- %s\n"), szError, szMessage);
|
||||
ConErrPrintf (_T("%s -- %s\n"), szMsg, szMessage);
|
||||
else
|
||||
ConErrPrintf (_T("%s\n"), szError);
|
||||
ConErrPrintf (_T("%s\n"), szMsg);
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID error_parameter_format(TCHAR ch)
|
||||
{
|
||||
ConErrPrintf (PARAMETERF_ERROR, ch);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_PARAMETERF_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg), ch);
|
||||
}
|
||||
|
||||
|
||||
VOID error_invalid_switch (TCHAR ch)
|
||||
{
|
||||
ConErrPrintf (INVALID_SWITCH, ch);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_INVALID_SWITCH, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg), ch);
|
||||
}
|
||||
|
||||
|
||||
VOID error_too_many_parameters (LPTSTR s)
|
||||
{
|
||||
ConErrPrintf (TOO_MANY_PARAMETERS, s);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_TOO_MANY_PARAMETERS, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg), s);
|
||||
}
|
||||
|
||||
|
||||
VOID error_path_not_found (VOID)
|
||||
{
|
||||
ConErrPrintf (PATH_NOT_FOUND);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_file_not_found (VOID)
|
||||
{
|
||||
ConErrPrintf (FILE_NOT_FOUND);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_sfile_not_found (LPTSTR f)
|
||||
{
|
||||
ConErrPrintf (FILE_NOT_FOUND _T(" - %s\n"), f);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf ("%s - %s\n", (LPTSTR)szMsg,f);
|
||||
}
|
||||
|
||||
|
||||
VOID error_req_param_missing (VOID)
|
||||
{
|
||||
ConErrPrintf (REQ_PARAM_MISSING);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_REQ_PARAM_MISSING, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_invalid_drive (VOID)
|
||||
{
|
||||
ConErrPrintf (INVALID_DRIVE);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_INVALID_DRIVE, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_bad_command (VOID)
|
||||
{
|
||||
ConErrPrintf (BADCOMMAND);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_BADCOMMAND, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_no_pipe (VOID)
|
||||
{
|
||||
ConErrPrintf (CANNOTPIPE);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_CANNOTPIPE, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_out_of_memory (VOID)
|
||||
{
|
||||
ConErrPrintf (OUT_OF_MEMORY);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_OUT_OF_MEMORY, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
||||
|
||||
VOID error_invalid_parameter_format (LPTSTR s)
|
||||
{
|
||||
ConErrPrintf (INVALID_PARAM_FORMAT, s);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_INVALID_PARAM_FORMAT, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConErrPrintf (_T((LPTSTR)szMsg), s);
|
||||
}
|
||||
|
||||
|
||||
VOID error_syntax (LPTSTR s)
|
||||
{
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
|
||||
if (s)
|
||||
ConErrPrintf (_T("Syntax error - %s\n"), s);
|
||||
ConErrPrintf (_T("%s - %s\n"),_T((LPTSTR)szMsg), s);
|
||||
else
|
||||
ConErrPrintf (_T("Syntax error.\n"));
|
||||
ConErrPrintf (_T("%s.\n"), _T((LPTSTR)szMsg) );
|
||||
}
|
||||
|
||||
|
||||
VOID msg_pause (VOID)
|
||||
{
|
||||
ConOutPuts (D_PAUSEMSG);
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString( GetModuleHandle(NULL), STRING_ERROR_D_PAUSEMSG, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPuts (_T((LPTSTR)szMsg));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
#define RC_STRING_MAX_SIZE 2048
|
||||
|
||||
|
||||
#define STRING_ERROR_PARAMETERF_ERROR 100
|
||||
#define STRING_ERROR_INVALID_SWITCH 101
|
||||
#define STRING_ERROR_TOO_MANY_PARAMETERS 102
|
||||
#define STRING_ERROR_PATH_NOT_FOUND 103
|
||||
#define STRING_ERROR_FILE_NOT_FOUND 104
|
||||
#define STRING_ERROR_REQ_PARAM_MISSING 105
|
||||
#define STRING_ERROR_INVALID_DRIVE 106
|
||||
#define STRING_ERROR_INVALID_PARAM_FORMAT 107
|
||||
#define STRING_ERROR_BADCOMMAND 108
|
||||
#define STRING_ERROR_OUT_OF_MEMORY 109
|
||||
#define STRING_ERROR_CANNOTPIPE 110
|
||||
#define STRING_ERROR_D_PAUSEMSG 111
|
||||
#define STRING_ERROR_DRIVER_NOT_READY 112
|
||||
|
||||
#define STRING_CHOICE_OPTION 200
|
||||
#define STRING_COPY_OPTION 201
|
||||
#define STRING_DEL_OPTION 202
|
||||
|
@ -36,7 +51,10 @@
|
|||
#define STRING_DEL_ERROR6 329
|
||||
#define STRING_DEL_ERROR7 330
|
||||
#define STRING_DEL_ERROR8 331
|
||||
#define STRING_PARAM_ERROR 332
|
||||
#define STRING_ERROR_ERROR1 332
|
||||
#define STRING_ERROR_ERROR2 333
|
||||
|
||||
#define STRING_PARAM_ERROR 334
|
||||
|
||||
#define STRING_ATTRIB_HELP 400
|
||||
#define STRING_ALIAS_HELP 401
|
||||
|
@ -81,10 +99,16 @@
|
|||
#define STRING_DIRSTACK_HELP3 438
|
||||
#define STRING_DIRSTACK_HELP4 439
|
||||
|
||||
#define STRING_EXIT_HELP 440
|
||||
#define STRING_MKDIR_HELP 441
|
||||
#define STRING_RMDIR_HELP 442
|
||||
#define STRING_REM_HELP 443
|
||||
#define STRING_ECHO_HELP1 440
|
||||
#define STRING_ECHO_HELP2 441
|
||||
#define STRING_ECHO_HELP3 442
|
||||
#define STRING_ECHO_HELP4 443
|
||||
#define STRING_ECHO_HELP5 444
|
||||
|
||||
#define STRING_EXIT_HELP 445
|
||||
#define STRING_MKDIR_HELP 446
|
||||
#define STRING_RMDIR_HELP 447
|
||||
#define STRING_REM_HELP 448
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue