mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
dir workaround
svn path=/trunk/; revision=391
This commit is contained in:
parent
464c5c2187
commit
1644f93c49
8 changed files with 264 additions and 30 deletions
|
@ -65,9 +65,7 @@
|
||||||
/*#define INCLUDE_CMD_CTTY*/
|
/*#define INCLUDE_CMD_CTTY*/
|
||||||
#define INCLUDE_CMD_DATE
|
#define INCLUDE_CMD_DATE
|
||||||
#define INCLUDE_CMD_DEL
|
#define INCLUDE_CMD_DEL
|
||||||
#ifndef __REACTOS__
|
|
||||||
#define INCLUDE_CMD_DIR
|
#define INCLUDE_CMD_DIR
|
||||||
#endif
|
|
||||||
#define INCLUDE_CMD_LABEL
|
#define INCLUDE_CMD_LABEL
|
||||||
#define INCLUDE_CMD_MKDIR
|
#define INCLUDE_CMD_MKDIR
|
||||||
#define INCLUDE_CMD_MOVE
|
#define INCLUDE_CMD_MOVE
|
||||||
|
|
|
@ -123,11 +123,13 @@
|
||||||
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#include <kernel32/li.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* flag definitions */
|
/* flag definitions */
|
||||||
/* Changed hex to decimal, hex wouldn't work
|
|
||||||
* if > 8, Rob Lake 06/17/98.
|
|
||||||
*/
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
DIR_RECURSE = 0x0001,
|
DIR_RECURSE = 0x0001,
|
||||||
|
@ -582,7 +584,11 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
||||||
INT c = 0;
|
INT c = 0;
|
||||||
INT n = 0;
|
INT n = 0;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
if (num.QuadPart == 0)
|
if (num.QuadPart == 0)
|
||||||
|
#else
|
||||||
|
if (num == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
des[0] = _T('0');
|
des[0] = _T('0');
|
||||||
des[1] = _T('\0');
|
des[1] = _T('\0');
|
||||||
|
@ -591,12 +597,21 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp[31] = 0;
|
temp[31] = 0;
|
||||||
|
#ifndef __REACTOS__
|
||||||
while (num.QuadPart > 0)
|
while (num.QuadPart > 0)
|
||||||
|
#else
|
||||||
|
while (num > 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (((c + 1) % (nNumberGroups + 1)) == 0)
|
if (((c + 1) % (nNumberGroups + 1)) == 0)
|
||||||
temp[30 - c++] = cThousandSeparator;
|
temp[30 - c++] = cThousandSeparator;
|
||||||
|
#ifndef __REACTOS__
|
||||||
temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
|
temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
|
||||||
num.QuadPart /= 10;
|
num.QuadPart /= 10;
|
||||||
|
#else
|
||||||
|
temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
|
||||||
|
num /= 10;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0; n <= c; n++)
|
for (n = 0; n <= c; n++)
|
||||||
|
@ -670,8 +685,13 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
||||||
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
||||||
|
|
||||||
ConvertULargeInteger (bytes, buffer, sizeof(buffer));
|
ConvertULargeInteger (bytes, buffer, sizeof(buffer));
|
||||||
|
#ifndef __REACTOS__
|
||||||
ConOutPrintf (_T(" %15s byte%c\n"),
|
ConOutPrintf (_T(" %15s byte%c\n"),
|
||||||
buffer, bytes.QuadPart == 1 ? _T(' ') : _T('s'));
|
buffer, bytes.QuadPart == 1 ? _T(' ') : _T('s'));
|
||||||
|
#else
|
||||||
|
ConOutPrintf (_T(" %15s byte%c\n"),
|
||||||
|
buffer, bytes == 1 ? _T(' ') : _T('s'));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (IncLine (pLine, dwFlags))
|
if (IncLine (pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -693,7 +713,11 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
||||||
|
|
||||||
szRoot[0] = szPath[0];
|
szRoot[0] = szPath[0];
|
||||||
GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl);
|
GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl);
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||||
|
#else
|
||||||
|
uliFree = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||||
|
#endif
|
||||||
ConvertULargeInteger (uliFree, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliFree, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %15s bytes free\n"), buffer);
|
ConOutPrintf (_T(" %15s bytes free\n"), buffer);
|
||||||
}
|
}
|
||||||
|
@ -724,7 +748,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
ULONG dircount = 0;
|
ULONG dircount = 0;
|
||||||
INT count;
|
INT count;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
bytecount.QuadPart = 0;
|
bytecount.QuadPart = 0;
|
||||||
|
#else
|
||||||
|
bytecount = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
_tcscpy (szFullPath, szPath);
|
_tcscpy (szFullPath, szPath);
|
||||||
if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
|
if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
|
||||||
|
@ -812,9 +840,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (dwFlags & DIR_BARE)
|
else if (dwFlags & DIR_BARE)
|
||||||
{
|
{
|
||||||
|
@ -843,9 +877,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
if (IncLine (pLine, dwFlags))
|
if (IncLine (pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -868,13 +908,22 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER uliSize;
|
ULARGE_INTEGER uliSize;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
#endif
|
||||||
|
|
||||||
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %20s"), buffer);
|
ConOutPrintf (_T(" %20s"), buffer);
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
filecount++;
|
filecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,13 +969,21 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER uliSize;
|
ULARGE_INTEGER uliSize;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
#endif
|
||||||
|
|
||||||
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %10s "), buffer);
|
ConOutPrintf (_T(" %10s "), buffer);
|
||||||
|
#ifndef __REACTOS__
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
filecount++;
|
filecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,7 +1018,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
recurse_dir_cnt += dircount;
|
recurse_dir_cnt += dircount;
|
||||||
recurse_file_cnt += filecount;
|
recurse_file_cnt += filecount;
|
||||||
|
#ifndef __REACTOS__
|
||||||
recurse_bytes.QuadPart += bytecount.QuadPart;
|
recurse_bytes.QuadPart += bytecount.QuadPart;
|
||||||
|
#else
|
||||||
|
recurse_bytes += bytecount;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* print_summary */
|
/* print_summary */
|
||||||
if (PrintSummary (szPath, filecount, dircount, bytecount, pLine, dwFlags))
|
if (PrintSummary (szPath, filecount, dircount, bytecount, pLine, dwFlags))
|
||||||
|
@ -1042,7 +1103,11 @@ DirRecurse (LPTSTR szPath, LPTSTR szSpec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
recurse_dir_cnt = 0L;
|
recurse_dir_cnt = 0L;
|
||||||
recurse_file_cnt = 0L;
|
recurse_file_cnt = 0L;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
recurse_bytes = 0;
|
||||||
|
#else
|
||||||
recurse_bytes.QuadPart = 0;
|
recurse_bytes.QuadPart = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!PrintDirectoryHeader (szPath, pLine, dwFlags))
|
if (!PrintDirectoryHeader (szPath, pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -72,4 +72,52 @@ void _makepath( char *path, const char *drive, const char *dir, const char *fnam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *strtok(char *s, const char *delim)
|
||||||
|
{
|
||||||
|
const char *spanp;
|
||||||
|
int c, sc;
|
||||||
|
char *tok;
|
||||||
|
static char *last;
|
||||||
|
|
||||||
|
if (s == NULL && (s = last) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
||||||
|
*/
|
||||||
|
cont:
|
||||||
|
c = *s++;
|
||||||
|
for (spanp = delim; (sc = *spanp++) != 0;) {
|
||||||
|
if (c == sc)
|
||||||
|
goto cont;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == 0) { /* no non-delimiter characters */
|
||||||
|
last = NULL;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
tok = s - 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||||
|
* Note that delim must have one NUL; we stop if we see that, too.
|
||||||
|
*/
|
||||||
|
for (;;) {
|
||||||
|
c = *s++;
|
||||||
|
spanp = delim;
|
||||||
|
do {
|
||||||
|
if ((sc = *spanp++) == c) {
|
||||||
|
if (c == 0)
|
||||||
|
s = NULL;
|
||||||
|
else
|
||||||
|
s[-1] = 0;
|
||||||
|
last = s;
|
||||||
|
return (tok);
|
||||||
|
}
|
||||||
|
} while (sc != 0);
|
||||||
|
}
|
||||||
|
/* NOTREACHED */
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,15 +31,19 @@
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static INT
|
||||||
PrintVolumeHeader (LPTSTR pszRootPath)
|
PrintVolumeHeader (LPTSTR pszRootPath)
|
||||||
{
|
{
|
||||||
TCHAR szVolName[80];
|
TCHAR szVolName[80];
|
||||||
DWORD dwSerialNr;
|
DWORD dwSerialNr;
|
||||||
|
|
||||||
/* get the volume information of the drive */
|
/* get the volume information of the drive */
|
||||||
GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
if(!GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
||||||
NULL, NULL, NULL, 0);
|
NULL, NULL, NULL, 0))
|
||||||
|
{
|
||||||
|
ErrorMessage (GetLastError (), _T(""));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* print drive info */
|
/* print drive info */
|
||||||
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
|
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
|
||||||
|
@ -52,6 +56,7 @@ PrintVolumeHeader (LPTSTR pszRootPath)
|
||||||
/* print the volume serial number */
|
/* print the volume serial number */
|
||||||
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
|
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
|
||||||
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +96,8 @@ INT cmd_vol (LPTSTR cmd, LPTSTR param)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the header */
|
/* print the header */
|
||||||
PrintVolumeHeader (szRootPath);
|
if (!PrintVolumeHeader (szRootPath))
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,9 +65,7 @@
|
||||||
/*#define INCLUDE_CMD_CTTY*/
|
/*#define INCLUDE_CMD_CTTY*/
|
||||||
#define INCLUDE_CMD_DATE
|
#define INCLUDE_CMD_DATE
|
||||||
#define INCLUDE_CMD_DEL
|
#define INCLUDE_CMD_DEL
|
||||||
#ifndef __REACTOS__
|
|
||||||
#define INCLUDE_CMD_DIR
|
#define INCLUDE_CMD_DIR
|
||||||
#endif
|
|
||||||
#define INCLUDE_CMD_LABEL
|
#define INCLUDE_CMD_LABEL
|
||||||
#define INCLUDE_CMD_MKDIR
|
#define INCLUDE_CMD_MKDIR
|
||||||
#define INCLUDE_CMD_MOVE
|
#define INCLUDE_CMD_MOVE
|
||||||
|
|
|
@ -123,11 +123,13 @@
|
||||||
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#include <kernel32/li.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* flag definitions */
|
/* flag definitions */
|
||||||
/* Changed hex to decimal, hex wouldn't work
|
|
||||||
* if > 8, Rob Lake 06/17/98.
|
|
||||||
*/
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
DIR_RECURSE = 0x0001,
|
DIR_RECURSE = 0x0001,
|
||||||
|
@ -582,7 +584,11 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
||||||
INT c = 0;
|
INT c = 0;
|
||||||
INT n = 0;
|
INT n = 0;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
if (num.QuadPart == 0)
|
if (num.QuadPart == 0)
|
||||||
|
#else
|
||||||
|
if (num == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
des[0] = _T('0');
|
des[0] = _T('0');
|
||||||
des[1] = _T('\0');
|
des[1] = _T('\0');
|
||||||
|
@ -591,12 +597,21 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp[31] = 0;
|
temp[31] = 0;
|
||||||
|
#ifndef __REACTOS__
|
||||||
while (num.QuadPart > 0)
|
while (num.QuadPart > 0)
|
||||||
|
#else
|
||||||
|
while (num > 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (((c + 1) % (nNumberGroups + 1)) == 0)
|
if (((c + 1) % (nNumberGroups + 1)) == 0)
|
||||||
temp[30 - c++] = cThousandSeparator;
|
temp[30 - c++] = cThousandSeparator;
|
||||||
|
#ifndef __REACTOS__
|
||||||
temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
|
temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
|
||||||
num.QuadPart /= 10;
|
num.QuadPart /= 10;
|
||||||
|
#else
|
||||||
|
temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
|
||||||
|
num /= 10;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0; n <= c; n++)
|
for (n = 0; n <= c; n++)
|
||||||
|
@ -670,8 +685,13 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
||||||
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
||||||
|
|
||||||
ConvertULargeInteger (bytes, buffer, sizeof(buffer));
|
ConvertULargeInteger (bytes, buffer, sizeof(buffer));
|
||||||
|
#ifndef __REACTOS__
|
||||||
ConOutPrintf (_T(" %15s byte%c\n"),
|
ConOutPrintf (_T(" %15s byte%c\n"),
|
||||||
buffer, bytes.QuadPart == 1 ? _T(' ') : _T('s'));
|
buffer, bytes.QuadPart == 1 ? _T(' ') : _T('s'));
|
||||||
|
#else
|
||||||
|
ConOutPrintf (_T(" %15s byte%c\n"),
|
||||||
|
buffer, bytes == 1 ? _T(' ') : _T('s'));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (IncLine (pLine, dwFlags))
|
if (IncLine (pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -693,7 +713,11 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
||||||
|
|
||||||
szRoot[0] = szPath[0];
|
szRoot[0] = szPath[0];
|
||||||
GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl);
|
GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl);
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||||
|
#else
|
||||||
|
uliFree = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||||
|
#endif
|
||||||
ConvertULargeInteger (uliFree, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliFree, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %15s bytes free\n"), buffer);
|
ConOutPrintf (_T(" %15s bytes free\n"), buffer);
|
||||||
}
|
}
|
||||||
|
@ -724,7 +748,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
ULONG dircount = 0;
|
ULONG dircount = 0;
|
||||||
INT count;
|
INT count;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
bytecount.QuadPart = 0;
|
bytecount.QuadPart = 0;
|
||||||
|
#else
|
||||||
|
bytecount = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
_tcscpy (szFullPath, szPath);
|
_tcscpy (szFullPath, szPath);
|
||||||
if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
|
if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
|
||||||
|
@ -812,9 +840,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (dwFlags & DIR_BARE)
|
else if (dwFlags & DIR_BARE)
|
||||||
{
|
{
|
||||||
|
@ -843,9 +877,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
if (IncLine (pLine, dwFlags))
|
if (IncLine (pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -868,13 +908,22 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER uliSize;
|
ULARGE_INTEGER uliSize;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
#endif
|
||||||
|
|
||||||
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %20s"), buffer);
|
ConOutPrintf (_T(" %20s"), buffer);
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
filecount++;
|
filecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,13 +969,21 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER uliSize;
|
ULARGE_INTEGER uliSize;
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
uliSize.u.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
|
#else
|
||||||
|
SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow);
|
||||||
|
SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh);
|
||||||
|
#endif
|
||||||
|
|
||||||
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %10s "), buffer);
|
ConOutPrintf (_T(" %10s "), buffer);
|
||||||
|
#ifndef __REACTOS__
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
#else
|
||||||
|
bytecount += uliSize;
|
||||||
|
#endif
|
||||||
filecount++;
|
filecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,7 +1018,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
recurse_dir_cnt += dircount;
|
recurse_dir_cnt += dircount;
|
||||||
recurse_file_cnt += filecount;
|
recurse_file_cnt += filecount;
|
||||||
|
#ifndef __REACTOS__
|
||||||
recurse_bytes.QuadPart += bytecount.QuadPart;
|
recurse_bytes.QuadPart += bytecount.QuadPart;
|
||||||
|
#else
|
||||||
|
recurse_bytes += bytecount;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* print_summary */
|
/* print_summary */
|
||||||
if (PrintSummary (szPath, filecount, dircount, bytecount, pLine, dwFlags))
|
if (PrintSummary (szPath, filecount, dircount, bytecount, pLine, dwFlags))
|
||||||
|
@ -1042,7 +1103,11 @@ DirRecurse (LPTSTR szPath, LPTSTR szSpec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
recurse_dir_cnt = 0L;
|
recurse_dir_cnt = 0L;
|
||||||
recurse_file_cnt = 0L;
|
recurse_file_cnt = 0L;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
recurse_bytes = 0;
|
||||||
|
#else
|
||||||
recurse_bytes.QuadPart = 0;
|
recurse_bytes.QuadPart = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!PrintDirectoryHeader (szPath, pLine, dwFlags))
|
if (!PrintDirectoryHeader (szPath, pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -72,4 +72,52 @@ void _makepath( char *path, const char *drive, const char *dir, const char *fnam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *strtok(char *s, const char *delim)
|
||||||
|
{
|
||||||
|
const char *spanp;
|
||||||
|
int c, sc;
|
||||||
|
char *tok;
|
||||||
|
static char *last;
|
||||||
|
|
||||||
|
if (s == NULL && (s = last) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
||||||
|
*/
|
||||||
|
cont:
|
||||||
|
c = *s++;
|
||||||
|
for (spanp = delim; (sc = *spanp++) != 0;) {
|
||||||
|
if (c == sc)
|
||||||
|
goto cont;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == 0) { /* no non-delimiter characters */
|
||||||
|
last = NULL;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
tok = s - 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||||
|
* Note that delim must have one NUL; we stop if we see that, too.
|
||||||
|
*/
|
||||||
|
for (;;) {
|
||||||
|
c = *s++;
|
||||||
|
spanp = delim;
|
||||||
|
do {
|
||||||
|
if ((sc = *spanp++) == c) {
|
||||||
|
if (c == 0)
|
||||||
|
s = NULL;
|
||||||
|
else
|
||||||
|
s[-1] = 0;
|
||||||
|
last = s;
|
||||||
|
return (tok);
|
||||||
|
}
|
||||||
|
} while (sc != 0);
|
||||||
|
}
|
||||||
|
/* NOTREACHED */
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,15 +31,19 @@
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static INT
|
||||||
PrintVolumeHeader (LPTSTR pszRootPath)
|
PrintVolumeHeader (LPTSTR pszRootPath)
|
||||||
{
|
{
|
||||||
TCHAR szVolName[80];
|
TCHAR szVolName[80];
|
||||||
DWORD dwSerialNr;
|
DWORD dwSerialNr;
|
||||||
|
|
||||||
/* get the volume information of the drive */
|
/* get the volume information of the drive */
|
||||||
GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
if(!GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
||||||
NULL, NULL, NULL, 0);
|
NULL, NULL, NULL, 0))
|
||||||
|
{
|
||||||
|
ErrorMessage (GetLastError (), _T(""));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* print drive info */
|
/* print drive info */
|
||||||
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
|
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
|
||||||
|
@ -52,6 +56,7 @@ PrintVolumeHeader (LPTSTR pszRootPath)
|
||||||
/* print the volume serial number */
|
/* print the volume serial number */
|
||||||
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
|
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
|
||||||
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +96,8 @@ INT cmd_vol (LPTSTR cmd, LPTSTR param)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the header */
|
/* print the header */
|
||||||
PrintVolumeHeader (szRootPath);
|
if (!PrintVolumeHeader (szRootPath))
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue