mirror of
https://github.com/reactos/reactos.git
synced 2024-06-27 16:31:30 +00:00
![Jeffrey Morlan](/assets/img/avatar_default.png)
- 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
74 lines
1.5 KiB
C
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 */
|