mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
- In cmd, add ConOutResPrintf and ConErrResPrintf functions for printf-ing from a resource string; use it to shorten several instances of LoadString+Con*Printf.
- Also change FilePromptYN and FilePromptYNA to take a resource ID. Remove varargs code which nobody used (and didn't actually work anyway) svn path=/trunk/; revision=34816
This commit is contained in:
parent
33ab9a11a5
commit
198d88a60b
27 changed files with 127 additions and 234 deletions
|
@ -19,7 +19,6 @@
|
|||
|
||||
INT CommandChcp (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR *arg;
|
||||
INT args;
|
||||
UINT uNewCodePage;
|
||||
|
@ -39,8 +38,7 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
|
|||
if (args == 0)
|
||||
{
|
||||
/* display active code page number */
|
||||
LoadString(CMD_ModuleHandle, STRING_CHCP_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, InputCodePage);
|
||||
ConErrResPrintf(STRING_CHCP_ERROR1, InputCodePage);
|
||||
freep (arg);
|
||||
return 0;
|
||||
}
|
||||
|
@ -48,8 +46,7 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
|
|||
if (args >= 2)
|
||||
{
|
||||
/* too many parameters */
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, param);
|
||||
ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, param);
|
||||
nErrorLevel = 1;
|
||||
freep (arg);
|
||||
return 1;
|
||||
|
@ -59,8 +56,7 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
if (uNewCodePage == 0)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, arg[0]);
|
||||
ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, arg[0]);
|
||||
freep (arg);
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
|
|
|
@ -102,7 +102,6 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive)
|
|||
INT
|
||||
CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR lpOptions;
|
||||
TCHAR Options[6];
|
||||
LPTSTR lpText = NULL;
|
||||
|
@ -208,8 +207,7 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
else if (arg[i][0] == _T('/'))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CHOICE_ERROR_OPTION, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, arg[i]);
|
||||
ConErrResPrintf(STRING_CHOICE_ERROR_OPTION, arg[i]);
|
||||
freep (arg);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -687,7 +687,6 @@ DoCommand (LPTSTR line)
|
|||
|
||||
VOID ParseCommandLine (LPTSTR cmd)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR cmdline[CMDLINE_LENGTH];
|
||||
LPTSTR s;
|
||||
#ifdef FEATURE_REDIRECTION
|
||||
|
@ -786,15 +785,13 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, in);
|
||||
ConErrResPrintf(STRING_CMD_ERROR1, in);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SetStdHandle (STD_INPUT_HANDLE, hFile))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, in);
|
||||
ConErrResPrintf(STRING_CMD_ERROR1, in);
|
||||
return;
|
||||
}
|
||||
TRACE ("Input redirected from: %s\n", debugstr_aw(in));
|
||||
|
@ -820,8 +817,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
|
||||
if (hFile[1] == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg);
|
||||
ConErrResPrintf(STRING_CMD_ERROR2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -884,8 +880,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
|
||||
if (out[size] != _T(':'))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, out);
|
||||
ConErrResPrintf(STRING_CMD_ERROR3, out);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -896,8 +891,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, out);
|
||||
ConErrResPrintf(STRING_CMD_ERROR3, out);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -905,8 +899,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
|
||||
if (!SetStdHandle (STD_OUTPUT_HANDLE, hFile))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, out);
|
||||
ConErrResPrintf(STRING_CMD_ERROR3, out);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -955,16 +948,14 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, err);
|
||||
ConErrResPrintf(STRING_CMD_ERROR3, err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SetStdHandle (STD_ERROR_HANDLE, hFile))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, err);
|
||||
ConErrResPrintf(STRING_CMD_ERROR3, err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,8 @@ VOID SetCursorType (BOOL, BOOL);
|
|||
|
||||
VOID ConOutResPuts (UINT resID);
|
||||
VOID ConErrResPuts (UINT resID);
|
||||
VOID ConOutResPrintf (UINT resID, ...);
|
||||
VOID ConErrResPrintf (UINT resID, ...);
|
||||
VOID ConOutResPaging(BOOL NewPage, UINT resID);
|
||||
|
||||
/* Prototypes for COPY.C */
|
||||
|
@ -311,8 +313,8 @@ VOID GetPathCase(TCHAR *, TCHAR *);
|
|||
#define PROMPT_BREAK 3
|
||||
|
||||
INT PagePrompt (VOID);
|
||||
INT FilePromptYN (LPTSTR, ...);
|
||||
INT FilePromptYNA (LPTSTR, ...);
|
||||
INT FilePromptYN (UINT);
|
||||
INT FilePromptYNA (UINT);
|
||||
|
||||
|
||||
/* Prototypes for MOVE.C */
|
||||
|
|
|
@ -65,8 +65,6 @@ VOID SetScreenColor (WORD wColor, BOOL bNoFill)
|
|||
*/
|
||||
INT CommandColor (LPTSTR first, LPTSTR rest)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
if (_tcsncmp (rest, _T("/?"), 2) == 0)
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_COLOR_HELP1);
|
||||
|
@ -115,14 +113,12 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
|
|||
|
||||
if (((bc) && (bc->bEcho)) || !bc)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COLOR_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, wColor);
|
||||
ConErrResPrintf(STRING_COLOR_ERROR3, wColor);
|
||||
}
|
||||
|
||||
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COLOR_ERROR4, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, wColor);
|
||||
ConErrResPrintf(STRING_COLOR_ERROR4, wColor);
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -382,6 +382,17 @@ VOID ConOutFormatMessage (DWORD MessageId, ...)
|
|||
}
|
||||
}
|
||||
|
||||
VOID ConOutResPrintf (UINT resID, ...)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
va_list arg_ptr;
|
||||
|
||||
va_start (arg_ptr, resID);
|
||||
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConPrintf(szMsg, arg_ptr, STD_OUTPUT_HANDLE);
|
||||
va_end (arg_ptr);
|
||||
}
|
||||
|
||||
VOID ConOutPrintf (LPTSTR szFormat, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
|
@ -421,6 +432,17 @@ VOID ConErrPuts (LPTSTR szText)
|
|||
}
|
||||
|
||||
|
||||
VOID ConErrResPrintf (UINT resID, ...)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
va_list arg_ptr;
|
||||
|
||||
va_start (arg_ptr, resID);
|
||||
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConPrintf(szMsg, arg_ptr, STD_ERROR_HANDLE);
|
||||
va_end (arg_ptr);
|
||||
}
|
||||
|
||||
VOID ConErrPrintf (LPTSTR szFormat, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
|
|
|
@ -54,7 +54,6 @@ copy (TCHAR source[MAX_PATH],
|
|||
DWORD lpdwFlags,
|
||||
BOOL bTouch)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
FILETIME srctime,NewFileTime;
|
||||
HANDLE hFileSrc;
|
||||
HANDLE hFileDest;
|
||||
|
@ -80,8 +79,7 @@ copy (TCHAR source[MAX_PATH],
|
|||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hFileSrc == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, source);
|
||||
ConOutResPrintf(STRING_COPY_ERROR1, source);
|
||||
nErrorLevel = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -108,8 +106,7 @@ copy (TCHAR source[MAX_PATH],
|
|||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hFileSrc == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, source);
|
||||
ConOutResPrintf(STRING_COPY_ERROR1, source);
|
||||
nErrorLevel = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -286,18 +283,15 @@ copy (TCHAR source[MAX_PATH],
|
|||
static INT CopyOverwrite (LPTSTR fn)
|
||||
{
|
||||
/*ask the user if they want to override*/
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
INT res;
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_HELP1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,fn);
|
||||
res = FilePromptYNA (_T(""));
|
||||
ConOutResPrintf(STRING_COPY_HELP1, fn);
|
||||
res = FilePromptYNA (0);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR *arg;
|
||||
INT argc, i, nFiles, nOverwrite = 0, nSrc = -1, nDes = -1;
|
||||
/* this is the path up to the folder of the src and dest ie C:\windows\ */
|
||||
|
@ -462,8 +456,7 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
default:
|
||||
/* Invalid switch */
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, _totupper(arg[i][1]));
|
||||
ConOutResPrintf(STRING_ERROR_INVALID_SWITCH, _totupper(arg[i][1]));
|
||||
nErrorLevel = 1;
|
||||
freep (arg);
|
||||
return 1;
|
||||
|
@ -524,8 +517,7 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
if(nFiles > 2)
|
||||
{
|
||||
/* There are too many file names in command */
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg,_T(""));
|
||||
ConErrResPrintf(STRING_ERROR_TOO_MANY_PARAMETERS,_T(""));
|
||||
nErrorLevel = 1;
|
||||
freep (arg);
|
||||
return 1;
|
||||
|
@ -604,8 +596,7 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
szTouch = _tcsstr (arg[nSrc], _T("+"));
|
||||
if(_tcsncmp (szTouch,_T("+,,\0"),4) || nDes != -1)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg,arg[nSrc]);
|
||||
ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT,arg[nSrc]);
|
||||
nErrorLevel = 1;
|
||||
freep (arg);
|
||||
return 1;
|
||||
|
@ -794,8 +785,7 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
/* Check to see if the file is the same file */
|
||||
if(!bTouch && !_tcscmp (tmpSrcPath, tmpDestPath))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg);
|
||||
ConOutResPrintf(STRING_COPY_ERROR2);
|
||||
|
||||
nErrorLevel = 1;
|
||||
break;
|
||||
|
@ -821,8 +811,7 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
else
|
||||
{
|
||||
/* print out the error message */
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg);
|
||||
ConOutResPrintf(STRING_COPY_ERROR3);
|
||||
ConOutFormatMessage (GetLastError(), szSrcPath);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
@ -834,8 +823,7 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
|||
} while(!bDone);
|
||||
|
||||
/* print out the number of files copied */
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_FILE, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, nFiles);
|
||||
ConOutResPrintf(STRING_COPY_FILE, nFiles);
|
||||
|
||||
FindClose(hFile);
|
||||
|
||||
|
|
|
@ -46,24 +46,19 @@ static WORD awMonths[2][13] =
|
|||
static VOID
|
||||
PrintDateString (VOID)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
switch (nDateFormat)
|
||||
{
|
||||
case 0: /* mmddyy */
|
||||
default:
|
||||
LoadString(CMD_ModuleHandle, STRING_DATE_HELP1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
|
||||
ConOutResPrintf(STRING_DATE_HELP1, cDateSeparator, cDateSeparator);
|
||||
break;
|
||||
|
||||
case 1: /* ddmmyy */
|
||||
LoadString(CMD_ModuleHandle, STRING_DATE_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
|
||||
ConOutResPrintf(STRING_DATE_HELP2, cDateSeparator, cDateSeparator);
|
||||
break;
|
||||
|
||||
case 2: /* yymmdd */
|
||||
LoadString(CMD_ModuleHandle, STRING_DATE_HELP3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
|
||||
ConOutResPrintf(STRING_DATE_HELP3, cDateSeparator, cDateSeparator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,12 +77,6 @@ enum
|
|||
};
|
||||
|
||||
static TCHAR szDeleteWipe[RC_STRING_MAX_SIZE];
|
||||
static TCHAR szDelHelp2[RC_STRING_MAX_SIZE];
|
||||
static TCHAR szDelHelp3[RC_STRING_MAX_SIZE];
|
||||
static TCHAR szDelHelp4[RC_STRING_MAX_SIZE];
|
||||
static TCHAR szDelError5[RC_STRING_MAX_SIZE];
|
||||
static TCHAR szDelError6[RC_STRING_MAX_SIZE];
|
||||
static TCHAR szDelError7[RC_STRING_MAX_SIZE];
|
||||
static TCHAR CMDPath[MAX_PATH];
|
||||
|
||||
static BOOLEAN StringsLoaded = FALSE;
|
||||
|
@ -90,12 +84,6 @@ static BOOLEAN StringsLoaded = FALSE;
|
|||
static VOID LoadStrings(VOID)
|
||||
{
|
||||
LoadString( CMD_ModuleHandle, STRING_DELETE_WIPE, szDeleteWipe, RC_STRING_MAX_SIZE);
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_HELP2, szDelHelp2, RC_STRING_MAX_SIZE);
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_HELP3, szDelHelp3, RC_STRING_MAX_SIZE);
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_HELP4, szDelHelp4, RC_STRING_MAX_SIZE);
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_ERROR5, szDelError5, RC_STRING_MAX_SIZE);
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_ERROR6, szDelError6, RC_STRING_MAX_SIZE);
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_ERROR7, szDelError7, RC_STRING_MAX_SIZE);
|
||||
GetModuleFileName(NULL, CMDPath, MAX_PATH);
|
||||
StringsLoaded = TRUE;
|
||||
}
|
||||
|
@ -193,7 +181,7 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
|||
|
||||
if (!((*dwFlags & DEL_YES) || (*dwFlags & DEL_QUIET) || (*dwFlags & DEL_PROMPT)))
|
||||
{
|
||||
res = FilePromptYNA (szDelHelp2);
|
||||
res = FilePromptYNA (STRING_DEL_HELP2);
|
||||
if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
|
||||
return 0x80000000;
|
||||
if(res == PROMPT_ALL)
|
||||
|
@ -256,9 +244,9 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
|||
/* ask for deleting */
|
||||
if (*dwFlags & DEL_PROMPT)
|
||||
{
|
||||
ConErrPrintf(szDelError5, szFullPath);
|
||||
ConErrResPrintf(STRING_DEL_ERROR5, szFullPath);
|
||||
|
||||
res = FilePromptYN (szDelError6);
|
||||
res = FilePromptYN (STRING_DEL_ERROR6);
|
||||
|
||||
if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
|
||||
{
|
||||
|
@ -270,7 +258,7 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
|||
/*user cant ask it to be quiet and tell you what it did*/
|
||||
if (!(*dwFlags & DEL_QUIET) && !(*dwFlags & DEL_TOTAL))
|
||||
{
|
||||
ConErrPrintf(szDelError7, szFullPath);
|
||||
ConErrResPrintf(STRING_DEL_ERROR7, szFullPath);
|
||||
}
|
||||
|
||||
/* delete the file */
|
||||
|
@ -552,11 +540,11 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
|
|||
dwFiles &= 0x7fffffff;
|
||||
if (dwFiles < 2)
|
||||
{
|
||||
ConOutPrintf(szDelHelp3, dwFiles);
|
||||
ConOutResPrintf(STRING_DEL_HELP3, dwFiles);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConOutPrintf(szDelHelp4, dwFiles);
|
||||
ConOutResPrintf(STRING_DEL_HELP4, dwFiles);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR p1, p2;
|
||||
|
||||
TRACE ("CommandEcho '%s' : '%s'\n", debugstr_aw(cmd), debugstr_aw(param));
|
||||
|
@ -98,8 +97,7 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
else
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_ECHO_HELP5, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, bEcho ? D_ON : D_OFF);
|
||||
ConOutResPrintf(STRING_ECHO_HELP5, bEcho ? D_ON : D_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,30 +61,21 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
|
||||
VOID error_parameter_format(TCHAR ch)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_PARAMETERF_ERROR, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, ch);
|
||||
ConErrResPrintf(STRING_ERROR_PARAMETERF_ERROR, ch);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_invalid_switch (TCHAR ch)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, ch);
|
||||
ConErrResPrintf(STRING_ERROR_INVALID_SWITCH, ch);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
||||
VOID error_too_many_parameters (LPTSTR s)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, s);
|
||||
ConErrResPrintf(STRING_ERROR_TOO_MANY_PARAMETERS, s);
|
||||
nErrorLevel = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ PrintDiskInfo (LPTSTR szDisk)
|
|||
|
||||
if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':'))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg);
|
||||
ConErrResPrintf(STRING_FREE_ERROR1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,8 +80,7 @@ PrintDiskInfo (LPTSTR szDisk)
|
|||
ConvertULargeInteger (uliSize, szFree, 40, TRUE);
|
||||
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
|
||||
ConOutResPrintf(STRING_FREE_HELP1, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,8 +124,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
}
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_GOTO_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, param);
|
||||
ConErrResPrintf(STRING_GOTO_ERROR2, param);
|
||||
ExitBatch(NULL);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,6 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
|||
TCHAR szFinalPath[MAX_PATH];
|
||||
TCHAR * tmpPath;
|
||||
TCHAR szCurrent[MAX_PATH];
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
INT i;
|
||||
|
||||
|
||||
|
@ -301,8 +300,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
|||
if(!tmpPath)
|
||||
{
|
||||
/* Didnt find an directories */
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg);
|
||||
ConErrResPrintf(STRING_ERROR_PATH_NOT_FOUND);
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -368,8 +366,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
/* Didnt find an directories */
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg);
|
||||
ConErrResPrintf(STRING_ERROR_PATH_NOT_FOUND);
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
|
||||
|
@ -414,8 +411,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
|||
}while(FindNextFile (hFile, &f));
|
||||
|
||||
/* Didnt find an directories */
|
||||
LoadString(CMD_ModuleHandle, STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg);
|
||||
ConErrResPrintf(STRING_ERROR_PATH_NOT_FOUND);
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -589,7 +585,6 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
|
|||
HANDLE hFile;
|
||||
WIN32_FIND_DATA f;
|
||||
INT res;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szFullPath[MAX_PATH];
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
|
@ -658,8 +653,7 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
|
|||
/* ask if they want to delete evrything in the folder */
|
||||
if (!RD_QUIET)
|
||||
{
|
||||
LoadString( CMD_ModuleHandle, STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
res = FilePromptYNA (szMsg);
|
||||
res = FilePromptYNA (STRING_DEL_HELP2);
|
||||
if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
|
||||
{
|
||||
freep(arg);
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
INT cmd_label (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szRootPath[] = _T("A:\\");
|
||||
TCHAR szLabel[80];
|
||||
TCHAR szOldLabel[80];
|
||||
|
@ -74,18 +73,15 @@ INT cmd_label (LPTSTR cmd, LPTSTR param)
|
|||
/* print drive info */
|
||||
if (szOldLabel[0] != _T('\0'))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_LABEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, _totupper(szRootPath[0]), szOldLabel);
|
||||
ConOutResPrintf(STRING_LABEL_HELP2, _totupper(szRootPath[0]), szOldLabel);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_LABEL_HELP3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, _totupper(szRootPath[0]));
|
||||
ConOutResPrintf(STRING_LABEL_HELP3, _totupper(szRootPath[0]));
|
||||
}
|
||||
|
||||
/* print the volume serial number */
|
||||
LoadString(CMD_ModuleHandle, STRING_LABEL_HELP4, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||
ConOutResPrintf(STRING_LABEL_HELP4, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||
|
||||
if (szLabel[0] == _T('\0'))
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@ ConvertDWord (DWORD num, LPTSTR des, INT len, BOOL bSeparator)
|
|||
|
||||
INT CommandMemory (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
MEMORYSTATUS ms;
|
||||
TCHAR szMemoryLoad[20];
|
||||
TCHAR szTotalPhys[20];
|
||||
|
@ -62,10 +61,9 @@ INT CommandMemory (LPTSTR cmd, LPTSTR param)
|
|||
ConvertDWord (ms.dwTotalVirtual, szTotalVirtual, 20, TRUE);
|
||||
ConvertDWord (ms.dwAvailVirtual, szAvailVirtual, 20, TRUE);
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_MEMMORY_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,
|
||||
szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
|
||||
szAvailPageFile, szTotalVirtual, szAvailVirtual);
|
||||
ConOutResPrintf(STRING_MEMMORY_HELP2,
|
||||
szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
|
||||
szAvailPageFile, szTotalVirtual, szAvailVirtual);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -519,22 +519,17 @@ INT PagePrompt (VOID)
|
|||
}
|
||||
|
||||
|
||||
INT FilePromptYN (LPTSTR szFormat, ...)
|
||||
INT FilePromptYN (UINT resID)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szOut[512];
|
||||
va_list arg_ptr;
|
||||
// TCHAR cKey = 0;
|
||||
// LPTSTR szKeys = _T("yna");
|
||||
|
||||
TCHAR szIn[10];
|
||||
LPTSTR p;
|
||||
|
||||
va_start (arg_ptr, szFormat);
|
||||
_vstprintf (szOut, szFormat, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
|
||||
ConOutPrintf (szFormat);
|
||||
if (resID != 0)
|
||||
ConOutResPrintf (resID);
|
||||
|
||||
/* preliminary fix */
|
||||
ConInString (szIn, 10);
|
||||
|
@ -589,22 +584,17 @@ INT FilePromptYN (LPTSTR szFormat, ...)
|
|||
}
|
||||
|
||||
|
||||
INT FilePromptYNA (LPTSTR szFormat, ...)
|
||||
INT FilePromptYNA (UINT resID)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szOut[512];
|
||||
va_list arg_ptr;
|
||||
// TCHAR cKey = 0;
|
||||
// LPTSTR szKeys = _T("yna");
|
||||
|
||||
TCHAR szIn[10];
|
||||
LPTSTR p;
|
||||
|
||||
va_start (arg_ptr, szFormat);
|
||||
_vstprintf (szOut, szFormat, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
|
||||
ConOutPrintf (szFormat);
|
||||
if (resID != 0)
|
||||
ConOutResPrintf (resID);
|
||||
|
||||
/* preliminary fix */
|
||||
ConInString (szIn, 10);
|
||||
|
|
|
@ -55,11 +55,9 @@ enum
|
|||
static INT MoveOverwrite (LPTSTR fn)
|
||||
{
|
||||
/*ask the user if they want to override*/
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
INT res;
|
||||
LoadString(CMD_ModuleHandle, STRING_MOVE_HELP1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,fn);
|
||||
res = FilePromptYNA (_T(""));
|
||||
ConOutResPrintf(STRING_MOVE_HELP1, fn);
|
||||
res = FilePromptYNA (0);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -87,7 +85,6 @@ void GetDirectory (LPTSTR wholepath, LPTSTR directory, BOOL CheckExisting)
|
|||
|
||||
INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR *arg;
|
||||
INT argc, i, nFiles;
|
||||
TCHAR szDestPath[MAX_PATH];
|
||||
|
@ -519,11 +516,9 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
}
|
||||
if (MoveStatus)
|
||||
LoadString(CMD_ModuleHandle, STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutResPrintf(STRING_MOVE_ERROR1);
|
||||
else
|
||||
LoadString(CMD_ModuleHandle, STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||
|
||||
ConOutPrintf(szMsg);
|
||||
ConOutResPrintf(STRING_MOVE_ERROR2);
|
||||
}
|
||||
while ((!OnlyOneFile || dwMoveStatusFlags & MOVE_SRC_CURRENT_IS_DIR ) &&
|
||||
!(dwMoveStatusFlags & MOVE_SOURCE_IS_DIR) &&
|
||||
|
|
|
@ -49,14 +49,12 @@ INT cmd_path (LPTSTR cmd, LPTSTR param)
|
|||
{
|
||||
DWORD dwBuffer;
|
||||
LPTSTR pszBuffer;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
|
||||
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
|
||||
if (dwBuffer == 0)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_VOL_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, _T("PATH"));
|
||||
ConOutResPrintf(STRING_VOL_HELP2, _T("PATH"));
|
||||
return 0;
|
||||
}
|
||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
|
|
|
@ -42,7 +42,6 @@ enum
|
|||
*/
|
||||
INT cmd_rename (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR *arg = NULL;
|
||||
INT args = 0;
|
||||
INT nEvalArgs = 0; /* nunber of evaluated arguments */
|
||||
|
@ -232,8 +231,7 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
|
|||
{
|
||||
if (!(dwFlags & REN_ERROR))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_REN_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, GetLastError());
|
||||
ConErrResPrintf(STRING_REN_ERROR1, GetLastError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,10 +243,9 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
|
|||
if (!(dwFlags & REN_QUIET))
|
||||
{
|
||||
if (dwFiles == 1)
|
||||
LoadString( CMD_ModuleHandle, STRING_REN_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutResPrintf(STRING_REN_HELP2, dwFiles);
|
||||
else
|
||||
LoadString( CMD_ModuleHandle, STRING_REN_HELP3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,dwFiles);
|
||||
ConOutResPrintf(STRING_REN_HELP3, dwFiles);
|
||||
}
|
||||
|
||||
freep(arg);
|
||||
|
|
|
@ -29,10 +29,7 @@ enum
|
|||
/*just makes a print out if there is a problem with the switches*/
|
||||
void invalid_switch(LPTSTR is)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,is);
|
||||
ConOutResPrintf(STRING_REPLACE_ERROR1,is);
|
||||
ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
|
||||
}
|
||||
|
||||
|
@ -49,7 +46,6 @@ void getPath(TCHAR* out, LPTSTR in)
|
|||
/*makes the replace*/
|
||||
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR d[MAX_PATH];
|
||||
TCHAR s[MAX_PATH];
|
||||
HANDLE hFileSrc, hFileDest;
|
||||
|
@ -71,8 +67,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
|
|||
hFileSrc = CreateFile (source, GENERIC_READ, FILE_SHARE_READ,NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hFileSrc == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, source);
|
||||
ConOutResPrintf(STRING_COPY_ERROR1, source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -99,8 +94,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
|
|||
|
||||
if (hFileSrc == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, dest);
|
||||
ConOutResPrintf(STRING_COPY_ERROR1, dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -125,20 +119,18 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
|
|||
{
|
||||
/* Output depending on add flag */
|
||||
if(dwFlags & REPLACE_ADD)
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_HELP9, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutResPrintf(STRING_REPLACE_HELP9, dest);
|
||||
else
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_HELP10, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, dest);
|
||||
if( !FilePromptYNA (_T("")))
|
||||
ConOutResPrintf(STRING_REPLACE_HELP10, dest);
|
||||
if( !FilePromptYNA (0))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Output depending on add flag */
|
||||
if(dwFlags & REPLACE_ADD)
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_HELP11, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutResPrintf(STRING_REPLACE_HELP11, dest);
|
||||
else
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_HELP5, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,dest);
|
||||
ConOutResPrintf(STRING_REPLACE_HELP5, dest);
|
||||
|
||||
/* Make sure source and destination is not the same */
|
||||
if(!_tcscmp(s, d))
|
||||
|
@ -210,7 +202,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
|
|||
/* Function to iterate over source files and call replace for each of them */
|
||||
INT recReplace(DWORD dwFlags, TCHAR szSrcPath[MAX_PATH], TCHAR szDestPath[MAX_PATH], BOOL *doMore)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE], tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH];
|
||||
TCHAR tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH];
|
||||
INT filesReplaced=0, i;
|
||||
DWORD dwAttrib = 0;
|
||||
HANDLE hFile;
|
||||
|
@ -269,8 +261,7 @@ INT recReplace(DWORD dwFlags, TCHAR szSrcPath[MAX_PATH], TCHAR szDestPath[MAX_PA
|
|||
{
|
||||
if(!(dwFlags & REPLACE_READ_ONLY))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_ERROR5, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, tmpDestPath);
|
||||
ConOutResPrintf(STRING_REPLACE_ERROR5, tmpDestPath);
|
||||
*doMore = FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -369,7 +360,6 @@ INT recFindSubDirs(DWORD dwFlags,
|
|||
|
||||
INT cmd_replace (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
LPTSTR *arg;
|
||||
INT argc, i,filesReplaced = 0, nFiles, srcIndex = -1, destIndex = -1;
|
||||
DWORD dwFlags = 0;
|
||||
|
@ -474,8 +464,7 @@ INT cmd_replace (LPTSTR cmd, LPTSTR param)
|
|||
if (_tcschr (arg[destIndex], _T('*')) != NULL ||
|
||||
_tcschr (arg[destIndex], _T('?')) != NULL)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,arg[destIndex]);
|
||||
ConOutResPrintf(STRING_REPLACE_ERROR2,arg[destIndex]);
|
||||
ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
|
||||
freep(arg);
|
||||
return 1;
|
||||
|
@ -484,8 +473,7 @@ INT cmd_replace (LPTSTR cmd, LPTSTR param)
|
|||
/* Make sure that destination exists */
|
||||
if(!IsExistingDirectory(szDestPath))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, szDestPath);
|
||||
ConOutResPrintf(STRING_REPLACE_ERROR2, szDestPath);
|
||||
ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
|
||||
freep(arg);
|
||||
return 1;
|
||||
|
@ -511,8 +499,7 @@ INT cmd_replace (LPTSTR cmd, LPTSTR param)
|
|||
/* Check so that source is not a directory, because that is not allowed */
|
||||
if(IsExistingDirectory(szSrcPath))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_ERROR6, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, szSrcPath);
|
||||
ConOutResPrintf(STRING_REPLACE_ERROR6, szSrcPath);
|
||||
ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
|
||||
freep(arg);
|
||||
return 1;
|
||||
|
@ -563,10 +550,9 @@ INT cmd_replace (LPTSTR cmd, LPTSTR param)
|
|||
{
|
||||
/* Add switch dependent output */
|
||||
if(dwFlags & REPLACE_ADD)
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_HELP8, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutResPrintf(STRING_REPLACE_HELP8, filesReplaced);
|
||||
else
|
||||
LoadString(CMD_ModuleHandle, STRING_REPLACE_HELP4, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, filesReplaced);
|
||||
ConOutResPrintf(STRING_REPLACE_HELP4, filesReplaced);
|
||||
}
|
||||
}
|
||||
/* Return memory */
|
||||
|
|
|
@ -53,7 +53,6 @@ skip_ws ( LPCTSTR p )
|
|||
|
||||
INT cmd_set (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
INT i;
|
||||
LPTSTR p;
|
||||
|
||||
|
@ -114,8 +113,7 @@ INT cmd_set (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
if ( !_tcsnicmp (param, _T("/"), 1) )
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_SYNTAX_COMMAND_INCORRECT, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf (szMsg, param);
|
||||
ConErrResPrintf (STRING_SYNTAX_COMMAND_INCORRECT, param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -126,8 +124,7 @@ INT cmd_set (LPTSTR cmd, LPTSTR param)
|
|||
if (p == param)
|
||||
{
|
||||
/* handle set =val case */
|
||||
LoadString(CMD_ModuleHandle, STRING_SYNTAX_COMMAND_INCORRECT, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf (szMsg, param);
|
||||
ConErrResPrintf (STRING_SYNTAX_COMMAND_INCORRECT, param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -149,8 +146,7 @@ INT cmd_set (LPTSTR cmd, LPTSTR param)
|
|||
dwBuffer = GetEnvironmentVariable (param, pszBuffer, ENV_BUFFER_SIZE);
|
||||
if (dwBuffer == 0)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_PATH_ERROR, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf (szMsg, param);
|
||||
ConErrResPrintf (STRING_PATH_ERROR, param);
|
||||
return 0;
|
||||
}
|
||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
static VOID
|
||||
PrintElapsedTime (DWORD time,INT format)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
DWORD h,m,s,ms;
|
||||
|
||||
TRACE ("PrintElapsedTime(%d,%d)",time,format);
|
||||
|
@ -42,8 +41,7 @@ PrintElapsedTime (DWORD time,INT format)
|
|||
switch (format)
|
||||
{
|
||||
case 0:
|
||||
LoadString(CMD_ModuleHandle, STRING_TIMER_HELP1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, time);
|
||||
ConOutResPrintf(STRING_TIMER_HELP1, time);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -53,11 +51,10 @@ PrintElapsedTime (DWORD time,INT format)
|
|||
time /=60;
|
||||
m = time % 60;
|
||||
h = time / 60;
|
||||
LoadString( CMD_ModuleHandle, STRING_TIMER_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg,
|
||||
h, cTimeSeparator,
|
||||
m, cTimeSeparator,
|
||||
s, cDecimalSeparator, ms/10);
|
||||
ConOutResPrintf(STRING_TIMER_HELP2,
|
||||
h, cTimeSeparator,
|
||||
m, cTimeSeparator,
|
||||
s, cDecimalSeparator, ms/10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +62,6 @@ PrintElapsedTime (DWORD time,INT format)
|
|||
|
||||
INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
// all timers are kept
|
||||
static DWORD clksT[10];
|
||||
|
||||
|
@ -99,15 +94,12 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
if (_tcsncmp (param, _T("/?"), 2) == 0)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_TIMER_HELP3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, cTimeSeparator, cTimeSeparator, cDecimalSeparator);
|
||||
ConOutResPrintf(STRING_TIMER_HELP3, cTimeSeparator, cTimeSeparator, cDecimalSeparator);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nErrorLevel = 0;
|
||||
|
||||
LoadString( CMD_ModuleHandle, STRING_TIMER_TIME, szMsg, RC_STRING_MAX_SIZE);
|
||||
|
||||
p = split (param, &argc, FALSE);
|
||||
|
||||
//read options
|
||||
|
@ -160,7 +152,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
cT=GetTickCount();
|
||||
cS=TRUE;
|
||||
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
freep(p);
|
||||
return 0;
|
||||
|
@ -170,7 +162,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
{
|
||||
if(cS)
|
||||
{
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
PrintElapsedTime(GetTickCount()-cT, iFormat);
|
||||
freep(p);
|
||||
|
@ -179,7 +171,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
cT=GetTickCount();
|
||||
cS=TRUE;
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
freep(p);
|
||||
return 0;
|
||||
|
@ -190,7 +182,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
if (cS)
|
||||
{
|
||||
cS=FALSE;
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
PrintElapsedTime(GetTickCount()-cT, iFormat);
|
||||
freep(p);
|
||||
|
@ -199,7 +191,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
cT=GetTickCount();
|
||||
cS=TRUE;
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
freep(p);
|
||||
return 0;
|
||||
|
@ -211,13 +203,13 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
if (cS)
|
||||
{
|
||||
cS=FALSE;
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
PrintElapsedTime(GetTickCount()-cT, iFormat);
|
||||
freep(p);
|
||||
return 0;
|
||||
}
|
||||
ConOutPrintf (szMsg,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
|
||||
PrintTime();
|
||||
freep(p);
|
||||
return 0;
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
INT cmd_type (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR buff[256];
|
||||
HANDLE hFile, hConsoleOut;
|
||||
BOOL bRet;
|
||||
|
@ -71,8 +70,7 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
|
|||
{
|
||||
if (_T('/') == argv[i][0] && _totupper(argv[i][1]) != _T('P'))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_TYPE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, argv[i] + 1);
|
||||
ConErrResPrintf(STRING_TYPE_ERROR1, argv[i] + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ VOID ShortVersion (VOID)
|
|||
OSVERSIONINFO VersionInfo;
|
||||
unsigned RosVersionLen;
|
||||
LPTSTR RosVersion;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
ConOutResPuts (STRING_CMD_SHELLINFO );
|
||||
VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
@ -44,8 +43,7 @@ VOID ShortVersion (VOID)
|
|||
(RosVersion - VersionInfo.szCSDVersion);
|
||||
if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7))
|
||||
{
|
||||
LoadString( CMD_ModuleHandle, STRING_VERSION_RUNVER, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf (szMsg, RosVersion);
|
||||
ConOutResPrintf(STRING_VERSION_RUNVER, RosVersion);
|
||||
}
|
||||
}
|
||||
ConOutPuts (_T("\n"));
|
||||
|
|
|
@ -29,8 +29,6 @@ static BOOL bVerify = FALSE;
|
|||
|
||||
INT cmd_verify (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_VERIFY_HELP1);
|
||||
|
@ -41,8 +39,7 @@ INT cmd_verify (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
if (!*param)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_VERIFY_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, bVerify ? D_ON : D_OFF);
|
||||
ConOutResPrintf(STRING_VERIFY_HELP2, bVerify ? D_ON : D_OFF);
|
||||
}
|
||||
else if (_tcsicmp (param, D_OFF) == 0)
|
||||
bVerify = FALSE;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
static INT
|
||||
PrintVolumeHeader (LPTSTR pszRootPath)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szVolName[80];
|
||||
DWORD dwSerialNr;
|
||||
|
||||
|
@ -49,18 +48,15 @@ PrintVolumeHeader (LPTSTR pszRootPath)
|
|||
/* print drive info */
|
||||
if (szVolName[0] != '\0')
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_VOL_HELP1, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, pszRootPath[0],szVolName);
|
||||
ConOutResPrintf(STRING_VOL_HELP1, pszRootPath[0],szVolName);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_VOL_HELP2, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, pszRootPath[0]);
|
||||
ConOutResPrintf(STRING_VOL_HELP2, pszRootPath[0]);
|
||||
}
|
||||
|
||||
/* print the volume serial number */
|
||||
LoadString(CMD_ModuleHandle, STRING_VOL_HELP3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||
ConOutResPrintf(STRING_VOL_HELP3, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue