mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 14:42:11 +00:00
[CMD]: Support space and tabs as parameter separators in the DIR command.
svn path=/trunk/; revision=67049
This commit is contained in:
parent
9beab72eb8
commit
fa57d9894f
1 changed files with 15 additions and 15 deletions
|
@ -163,7 +163,7 @@ typedef struct _DirSwitchesFlags
|
||||||
{
|
{
|
||||||
BOOL bBareFormat; /* Bare Format */
|
BOOL bBareFormat; /* Bare Format */
|
||||||
BOOL bTSeperator; /* Thousands seperator */
|
BOOL bTSeperator; /* Thousands seperator */
|
||||||
BOOL bWideList; /* Wide list format */
|
BOOL bWideList; /* Wide list format */
|
||||||
BOOL bWideListColSort; /* Wide list format but sorted by column */
|
BOOL bWideListColSort; /* Wide list format but sorted by column */
|
||||||
BOOL bLowerCase; /* Uses lower case */
|
BOOL bLowerCase; /* Uses lower case */
|
||||||
BOOL bNewLongList; /* New long list */
|
BOOL bNewLongList; /* New long list */
|
||||||
|
@ -264,7 +264,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
/* When a switch is expecting */
|
/* When a switch is expecting */
|
||||||
if (cCurSwitch == _T('/'))
|
if (cCurSwitch == _T('/'))
|
||||||
{
|
{
|
||||||
while (*Line == _T(' '))
|
while (_istspace(*Line))
|
||||||
Line++;
|
Line++;
|
||||||
|
|
||||||
bNegative = (*Line == _T('-'));
|
bNegative = (*Line == _T('-'));
|
||||||
|
@ -334,12 +334,12 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error_invalid_switch ((TCHAR)_totupper (*Line));
|
error_invalid_switch ((TCHAR)_totupper(*Line));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure there's no extra characters at the end of the switch */
|
/* Make sure there's no extra characters at the end of the switch */
|
||||||
if (Line[1] && Line[1] != _T('/') && Line[1] != _T(' '))
|
if (Line[1] && Line[1] != _T('/') && !_istspace(Line[1]))
|
||||||
{
|
{
|
||||||
error_parameter_format(Line[1]);
|
error_parameter_format(Line[1]);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -354,7 +354,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
|
|
||||||
if (cCurChar == _T('/'))
|
if (cCurChar == _T('/'))
|
||||||
cCurSwitch = _T('/');
|
cCurSwitch = _T('/');
|
||||||
else if (cCurChar == _T(' '))
|
else if (_istspace(cCurChar))
|
||||||
/* do nothing */;
|
/* do nothing */;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
bIntoQuotes = FALSE;
|
bIntoQuotes = FALSE;
|
||||||
while (*Line)
|
while (*Line)
|
||||||
{
|
{
|
||||||
if (!bIntoQuotes && (*Line == _T('/') || *Line == _T(' ')))
|
if (!bIntoQuotes && (*Line == _T('/') || _istspace(*Line)))
|
||||||
break;
|
break;
|
||||||
bIntoQuotes ^= (*Line == _T('"'));
|
bIntoQuotes ^= (*Line == _T('"'));
|
||||||
Line++;
|
Line++;
|
||||||
|
@ -394,7 +394,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
/* We are waiting for switch parameters */
|
/* We are waiting for switch parameters */
|
||||||
|
|
||||||
/* Check if there are no more switch parameters */
|
/* Check if there are no more switch parameters */
|
||||||
if ((cCurChar == _T('/')) || ( cCurChar == _T(' ')))
|
if ((cCurChar == _T('/')) || _istspace(cCurChar))
|
||||||
{
|
{
|
||||||
/* Wrong desicion path, reprocess current character */
|
/* Wrong desicion path, reprocess current character */
|
||||||
cCurSwitch = _T(' ');
|
cCurSwitch = _T(' ');
|
||||||
|
@ -403,7 +403,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
/* Process parameter switch */
|
/* Process parameter switch */
|
||||||
switch(cCurSwitch)
|
switch(cCurSwitch)
|
||||||
{
|
{
|
||||||
case _T('A'): /* Switch parameters for /A (attributes filter) */
|
case _T('A'): /* Switch parameters for /A (attributes filter) */
|
||||||
if (cCurChar == _T('-'))
|
if (cCurChar == _T('-'))
|
||||||
bPNegative = TRUE;
|
bPNegative = TRUE;
|
||||||
else if (cCurUChar == _T('D'))
|
else if (cCurUChar == _T('D'))
|
||||||
|
@ -452,7 +452,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _T('T'): /* Switch parameters for /T (time field) */
|
case _T('T'): /* Switch parameters for /T (time field) */
|
||||||
if (cCurUChar == _T('C'))
|
if (cCurUChar == _T('C'))
|
||||||
lpFlags->stTimeField.eTimeField= TF_CREATIONDATE ;
|
lpFlags->stTimeField.eTimeField= TF_CREATIONDATE ;
|
||||||
else if (cCurUChar == _T('A'))
|
else if (cCurUChar == _T('A'))
|
||||||
|
@ -1155,7 +1155,7 @@ CompareFiles(LPWIN32_FIND_DATA lpFile1, /* [IN] A pointer to WIN32_FIND_DATA of
|
||||||
/* Calculate criteria */
|
/* Calculate criteria */
|
||||||
switch(lpFlags->stOrderBy.eCriteria[i])
|
switch(lpFlags->stOrderBy.eCriteria[i])
|
||||||
{
|
{
|
||||||
case ORDER_SIZE: /* Order by size /o:s */
|
case ORDER_SIZE: /* Order by size /o:s */
|
||||||
/* concat the 32bit integers to a 64bit */
|
/* concat the 32bit integers to a 64bit */
|
||||||
u64File1.LowPart = lpFile1->nFileSizeLow;
|
u64File1.LowPart = lpFile1->nFileSizeLow;
|
||||||
u64File1.HighPart = lpFile1->nFileSizeHigh;
|
u64File1.HighPart = lpFile1->nFileSizeHigh;
|
||||||
|
@ -1171,20 +1171,20 @@ CompareFiles(LPWIN32_FIND_DATA lpFile1, /* [IN] A pointer to WIN32_FIND_DATA of
|
||||||
iComp = 0;
|
iComp = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_DIRECTORY: /* Order by directory attribute /o:g */
|
case ORDER_DIRECTORY: /* Order by directory attribute /o:g */
|
||||||
iComp = ((lpFile2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)-
|
iComp = ((lpFile2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)-
|
||||||
(lpFile1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
(lpFile1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_EXTENSION: /* Order by extension name /o:e */
|
case ORDER_EXTENSION: /* Order by extension name /o:e */
|
||||||
iComp = _tcsicmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
|
iComp = _tcsicmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_NAME: /* Order by filename /o:n */
|
case ORDER_NAME: /* Order by filename /o:n */
|
||||||
iComp = _tcsicmp(lpFile1->cFileName, lpFile2->cFileName);
|
iComp = _tcsicmp(lpFile1->cFileName, lpFile2->cFileName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_TIME: /* Order by file's time /o:t */
|
case ORDER_TIME: /* Order by file's time /o:t */
|
||||||
/* We compare files based on the time field selected by /t */
|
/* We compare files based on the time field selected by /t */
|
||||||
switch(lpFlags->stTimeField.eTimeField)
|
switch(lpFlags->stTimeField.eTimeField)
|
||||||
{
|
{
|
||||||
|
@ -1333,7 +1333,7 @@ DirList(LPTSTR szPath, /* [IN] The path that dir starts */
|
||||||
if (ptrStartNode == NULL)
|
if (ptrStartNode == NULL)
|
||||||
{
|
{
|
||||||
WARN("DEBUG: Cannot allocate memory for ptrStartNode!\n");
|
WARN("DEBUG: Cannot allocate memory for ptrStartNode!\n");
|
||||||
return 1; /* Error cannot allocate memory for 1st object */
|
return 1; /* Error cannot allocate memory for 1st object */
|
||||||
}
|
}
|
||||||
ptrNextNode = ptrStartNode;
|
ptrNextNode = ptrStartNode;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue