reactos/reactos/base/shell/cmd/memory.c
Jeffrey Morlan c49ed3a82c Remove the "LPTSTR cmd" argument to internal commands; there's no need for a command to be told its own name. It was only used in two places:
- a hack in cmd_mkdir that was already obsolete a decade ago
- to distinguish "echo" from "echo.", but that is the wrong way to implement this anyway. There's nothing particularly special about the period, "echo" is just one of those commands that is lenient about where its parameters begin, and when it echos a line, the first character (usually a space, but in the case of "echo." a period) is skipped.

svn path=/trunk/; revision=35647
2008-08-25 23:22:03 +00:00

74 lines
1.5 KiB
C

/*
* MEMORY.C - internal command.
*
*
* History:
*
* 01-Sep-1999 (Eric Kohl)
* Started.
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* Remove all hardcode string to En.rc
*/
#include <precomp.h>
#ifdef INCLUDE_CMD_MEMORY
/*
* convert
*
* insert commas into a number
*/
static INT
ConvertDWord (DWORD num, LPTSTR des, INT len, BOOL bSeparator)
{
ULARGE_INTEGER ui;
ui.u.LowPart = num;
ui.u.HighPart = 0;
return ConvertULargeInteger(ui, des, len, bSeparator);
}
INT CommandMemory (LPTSTR param)
{
MEMORYSTATUS ms;
TCHAR szMemoryLoad[20];
TCHAR szTotalPhys[20];
TCHAR szAvailPhys[20];
TCHAR szTotalPageFile[20];
TCHAR szAvailPageFile[20];
TCHAR szTotalVirtual[20];
TCHAR szAvailVirtual[20];
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutResPaging(TRUE,STRING_MEMMORY_HELP1);
return 0;
}
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus (&ms);
ConvertDWord (ms.dwMemoryLoad, szMemoryLoad, 20, FALSE);
ConvertDWord (ms.dwTotalPhys, szTotalPhys, 20, TRUE);
ConvertDWord (ms.dwAvailPhys, szAvailPhys, 20, TRUE);
ConvertDWord (ms.dwTotalPageFile, szTotalPageFile, 20, TRUE);
ConvertDWord (ms.dwAvailPageFile, szAvailPageFile, 20, TRUE);
ConvertDWord (ms.dwTotalVirtual, szTotalVirtual, 20, TRUE);
ConvertDWord (ms.dwAvailVirtual, szAvailVirtual, 20, TRUE);
ConOutResPrintf(STRING_MEMMORY_HELP2,
szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
szAvailPageFile, szTotalVirtual, szAvailVirtual);
return 0;
}
#endif /* INCLUDE_CMD_MEMORY */
/* EOF */