mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 00:54:40 +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_DATE
|
||||
#define INCLUDE_CMD_DEL
|
||||
#ifndef __REACTOS__
|
||||
#define INCLUDE_CMD_DIR
|
||||
#endif
|
||||
#define INCLUDE_CMD_LABEL
|
||||
#define INCLUDE_CMD_MKDIR
|
||||
#define INCLUDE_CMD_MOVE
|
||||
|
|
|
@ -123,11 +123,13 @@
|
|||
|
||||
#include "cmd.h"
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include <kernel32/li.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* flag definitions */
|
||||
/* Changed hex to decimal, hex wouldn't work
|
||||
* if > 8, Rob Lake 06/17/98.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DIR_RECURSE = 0x0001,
|
||||
|
@ -582,7 +584,11 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
|||
INT c = 0;
|
||||
INT n = 0;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (num.QuadPart == 0)
|
||||
#else
|
||||
if (num == 0)
|
||||
#endif
|
||||
{
|
||||
des[0] = _T('0');
|
||||
des[1] = _T('\0');
|
||||
|
@ -591,12 +597,21 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
|||
else
|
||||
{
|
||||
temp[31] = 0;
|
||||
#ifndef __REACTOS__
|
||||
while (num.QuadPart > 0)
|
||||
#else
|
||||
while (num > 0)
|
||||
#endif
|
||||
{
|
||||
if (((c + 1) % (nNumberGroups + 1)) == 0)
|
||||
temp[30 - c++] = cThousandSeparator;
|
||||
#ifndef __REACTOS__
|
||||
temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
|
||||
num.QuadPart /= 10;
|
||||
#else
|
||||
temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
|
||||
num /= 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
for (n = 0; n <= c; n++)
|
||||
|
@ -667,11 +682,16 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
|||
/* print number of files and bytes */
|
||||
ConvertULong (ulFiles, buffer, sizeof(buffer));
|
||||
ConOutPrintf (_T(" %6s File%c"),
|
||||
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
||||
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
||||
|
||||
ConvertULargeInteger (bytes, buffer, sizeof(buffer));
|
||||
#ifndef __REACTOS__
|
||||
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))
|
||||
return 1;
|
||||
|
@ -679,7 +699,7 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
|||
/* print number of dirs and bytes free */
|
||||
ConvertULong (ulDirs, buffer, sizeof(buffer));
|
||||
ConOutPrintf (_T(" %6s Dir%c"),
|
||||
buffer, ulDirs == 1 ? _T(' ') : _T('s'));
|
||||
buffer, ulDirs == 1 ? _T(' ') : _T('s'));
|
||||
|
||||
|
||||
if (!(dwFlags & DIR_RECURSE))
|
||||
|
@ -693,7 +713,11 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
|||
|
||||
szRoot[0] = szPath[0];
|
||||
GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl);
|
||||
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||
#ifndef __REACTOS__
|
||||
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||
#else
|
||||
uliFree = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||
#endif
|
||||
ConvertULargeInteger (uliFree, buffer, sizeof(buffer));
|
||||
ConOutPrintf (_T(" %15s bytes free\n"), buffer);
|
||||
}
|
||||
|
@ -724,7 +748,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
ULONG dircount = 0;
|
||||
INT count;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
bytecount.QuadPart = 0;
|
||||
#else
|
||||
bytecount = 0;
|
||||
#endif
|
||||
|
||||
_tcscpy (szFullPath, szPath);
|
||||
if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
|
||||
|
@ -812,9 +840,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
count = 0;
|
||||
}
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||
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)
|
||||
{
|
||||
|
@ -843,9 +877,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
if (IncLine (pLine, dwFlags))
|
||||
return 1;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||
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
|
||||
{
|
||||
|
@ -868,14 +908,23 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
{
|
||||
ULARGE_INTEGER uliSize;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
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));
|
||||
ConOutPrintf (_T(" %20s"), buffer);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
bytecount.QuadPart += uliSize.QuadPart;
|
||||
filecount++;
|
||||
#else
|
||||
bytecount += uliSize;
|
||||
#endif
|
||||
filecount++;
|
||||
}
|
||||
|
||||
/* print long filename */
|
||||
|
@ -920,13 +969,21 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
{
|
||||
ULARGE_INTEGER uliSize;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
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));
|
||||
ConOutPrintf (_T(" %10s "), buffer);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
bytecount.QuadPart += uliSize.QuadPart;
|
||||
#else
|
||||
bytecount += uliSize;
|
||||
#endif
|
||||
filecount++;
|
||||
}
|
||||
|
||||
|
@ -961,7 +1018,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
{
|
||||
recurse_dir_cnt += dircount;
|
||||
recurse_file_cnt += filecount;
|
||||
#ifndef __REACTOS__
|
||||
recurse_bytes.QuadPart += bytecount.QuadPart;
|
||||
#else
|
||||
recurse_bytes += bytecount;
|
||||
#endif
|
||||
|
||||
/* print_summary */
|
||||
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_file_cnt = 0L;
|
||||
#ifdef __REACTOS__
|
||||
recurse_bytes = 0;
|
||||
#else
|
||||
recurse_bytes.QuadPart = 0;
|
||||
#endif
|
||||
|
||||
if (!PrintDirectoryHeader (szPath, pLine, dwFlags))
|
||||
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
|
||||
|
|
|
@ -31,15 +31,19 @@
|
|||
#include "cmd.h"
|
||||
|
||||
|
||||
static VOID
|
||||
static INT
|
||||
PrintVolumeHeader (LPTSTR pszRootPath)
|
||||
{
|
||||
TCHAR szVolName[80];
|
||||
DWORD dwSerialNr;
|
||||
|
||||
/* get the volume information of the drive */
|
||||
GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
||||
NULL, NULL, NULL, 0);
|
||||
if(!GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
||||
NULL, NULL, NULL, 0))
|
||||
{
|
||||
ErrorMessage (GetLastError (), _T(""));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* print drive info */
|
||||
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
|
||||
|
@ -52,6 +56,7 @@ PrintVolumeHeader (LPTSTR pszRootPath)
|
|||
/* print the volume serial number */
|
||||
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
|
||||
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +96,8 @@ INT cmd_vol (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
|
||||
/* print the header */
|
||||
PrintVolumeHeader (szRootPath);
|
||||
if (!PrintVolumeHeader (szRootPath))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,7 @@
|
|||
/*#define INCLUDE_CMD_CTTY*/
|
||||
#define INCLUDE_CMD_DATE
|
||||
#define INCLUDE_CMD_DEL
|
||||
#ifndef __REACTOS__
|
||||
#define INCLUDE_CMD_DIR
|
||||
#endif
|
||||
#define INCLUDE_CMD_LABEL
|
||||
#define INCLUDE_CMD_MKDIR
|
||||
#define INCLUDE_CMD_MOVE
|
||||
|
|
|
@ -123,11 +123,13 @@
|
|||
|
||||
#include "cmd.h"
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include <kernel32/li.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* flag definitions */
|
||||
/* Changed hex to decimal, hex wouldn't work
|
||||
* if > 8, Rob Lake 06/17/98.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DIR_RECURSE = 0x0001,
|
||||
|
@ -582,7 +584,11 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
|||
INT c = 0;
|
||||
INT n = 0;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (num.QuadPart == 0)
|
||||
#else
|
||||
if (num == 0)
|
||||
#endif
|
||||
{
|
||||
des[0] = _T('0');
|
||||
des[1] = _T('\0');
|
||||
|
@ -591,12 +597,21 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
|||
else
|
||||
{
|
||||
temp[31] = 0;
|
||||
#ifndef __REACTOS__
|
||||
while (num.QuadPart > 0)
|
||||
#else
|
||||
while (num > 0)
|
||||
#endif
|
||||
{
|
||||
if (((c + 1) % (nNumberGroups + 1)) == 0)
|
||||
temp[30 - c++] = cThousandSeparator;
|
||||
#ifndef __REACTOS__
|
||||
temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
|
||||
num.QuadPart /= 10;
|
||||
#else
|
||||
temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
|
||||
num /= 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
for (n = 0; n <= c; n++)
|
||||
|
@ -667,11 +682,16 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
|||
/* print number of files and bytes */
|
||||
ConvertULong (ulFiles, buffer, sizeof(buffer));
|
||||
ConOutPrintf (_T(" %6s File%c"),
|
||||
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
||||
buffer, ulFiles == 1 ? _T(' ') : _T('s'));
|
||||
|
||||
ConvertULargeInteger (bytes, buffer, sizeof(buffer));
|
||||
#ifndef __REACTOS__
|
||||
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))
|
||||
return 1;
|
||||
|
@ -679,7 +699,7 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
|||
/* print number of dirs and bytes free */
|
||||
ConvertULong (ulDirs, buffer, sizeof(buffer));
|
||||
ConOutPrintf (_T(" %6s Dir%c"),
|
||||
buffer, ulDirs == 1 ? _T(' ') : _T('s'));
|
||||
buffer, ulDirs == 1 ? _T(' ') : _T('s'));
|
||||
|
||||
|
||||
if (!(dwFlags & DIR_RECURSE))
|
||||
|
@ -693,7 +713,11 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes,
|
|||
|
||||
szRoot[0] = szPath[0];
|
||||
GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl);
|
||||
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||
#ifndef __REACTOS__
|
||||
uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||
#else
|
||||
uliFree = dwSecPerCl * dwBytPerSec * dwFreeCl;
|
||||
#endif
|
||||
ConvertULargeInteger (uliFree, buffer, sizeof(buffer));
|
||||
ConOutPrintf (_T(" %15s bytes free\n"), buffer);
|
||||
}
|
||||
|
@ -724,7 +748,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
ULONG dircount = 0;
|
||||
INT count;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
bytecount.QuadPart = 0;
|
||||
#else
|
||||
bytecount = 0;
|
||||
#endif
|
||||
|
||||
_tcscpy (szFullPath, szPath);
|
||||
if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
|
||||
|
@ -812,9 +840,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
count = 0;
|
||||
}
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||
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)
|
||||
{
|
||||
|
@ -843,9 +877,15 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
if (IncLine (pLine, dwFlags))
|
||||
return 1;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||
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
|
||||
{
|
||||
|
@ -868,14 +908,23 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
{
|
||||
ULARGE_INTEGER uliSize;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
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));
|
||||
ConOutPrintf (_T(" %20s"), buffer);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
bytecount.QuadPart += uliSize.QuadPart;
|
||||
filecount++;
|
||||
#else
|
||||
bytecount += uliSize;
|
||||
#endif
|
||||
filecount++;
|
||||
}
|
||||
|
||||
/* print long filename */
|
||||
|
@ -920,13 +969,21 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
{
|
||||
ULARGE_INTEGER uliSize;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
uliSize.u.LowPart = file.nFileSizeLow;
|
||||
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));
|
||||
ConOutPrintf (_T(" %10s "), buffer);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
bytecount.QuadPart += uliSize.QuadPart;
|
||||
#else
|
||||
bytecount += uliSize;
|
||||
#endif
|
||||
filecount++;
|
||||
}
|
||||
|
||||
|
@ -961,7 +1018,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
|||
{
|
||||
recurse_dir_cnt += dircount;
|
||||
recurse_file_cnt += filecount;
|
||||
#ifndef __REACTOS__
|
||||
recurse_bytes.QuadPart += bytecount.QuadPart;
|
||||
#else
|
||||
recurse_bytes += bytecount;
|
||||
#endif
|
||||
|
||||
/* print_summary */
|
||||
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_file_cnt = 0L;
|
||||
#ifdef __REACTOS__
|
||||
recurse_bytes = 0;
|
||||
#else
|
||||
recurse_bytes.QuadPart = 0;
|
||||
#endif
|
||||
|
||||
if (!PrintDirectoryHeader (szPath, pLine, dwFlags))
|
||||
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
|
||||
|
|
|
@ -31,15 +31,19 @@
|
|||
#include "cmd.h"
|
||||
|
||||
|
||||
static VOID
|
||||
static INT
|
||||
PrintVolumeHeader (LPTSTR pszRootPath)
|
||||
{
|
||||
TCHAR szVolName[80];
|
||||
DWORD dwSerialNr;
|
||||
|
||||
/* get the volume information of the drive */
|
||||
GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
||||
NULL, NULL, NULL, 0);
|
||||
if(!GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
|
||||
NULL, NULL, NULL, 0))
|
||||
{
|
||||
ErrorMessage (GetLastError (), _T(""));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* print drive info */
|
||||
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
|
||||
|
@ -52,6 +56,7 @@ PrintVolumeHeader (LPTSTR pszRootPath)
|
|||
/* print the volume serial number */
|
||||
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
|
||||
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +96,8 @@ INT cmd_vol (LPTSTR cmd, LPTSTR param)
|
|||
}
|
||||
|
||||
/* print the header */
|
||||
PrintVolumeHeader (szRootPath);
|
||||
if (!PrintVolumeHeader (szRootPath))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue