[CMD]: Support space and tabs as parameter separators in the DIR command.

svn path=/trunk/; revision=67049
This commit is contained in:
Hermès Bélusca-Maïto 2015-04-04 15:44:55 +00:00
parent 9beab72eb8
commit fa57d9894f

View file

@ -264,7 +264,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
/* When a switch is expecting */
if (cCurSwitch == _T('/'))
{
while (*Line == _T(' '))
while (_istspace(*Line))
Line++;
bNegative = (*Line == _T('-'));
@ -334,12 +334,12 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
}
else
{
error_invalid_switch ((TCHAR)_totupper (*Line));
error_invalid_switch ((TCHAR)_totupper(*Line));
return FALSE;
}
/* 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]);
return FALSE;
@ -354,7 +354,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
if (cCurChar == _T('/'))
cCurSwitch = _T('/');
else if (cCurChar == _T(' '))
else if (_istspace(cCurChar))
/* do nothing */;
else
{
@ -363,7 +363,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
bIntoQuotes = FALSE;
while (*Line)
{
if (!bIntoQuotes && (*Line == _T('/') || *Line == _T(' ')))
if (!bIntoQuotes && (*Line == _T('/') || _istspace(*Line)))
break;
bIntoQuotes ^= (*Line == _T('"'));
Line++;
@ -394,7 +394,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
/* We are waiting for 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 */
cCurSwitch = _T(' ');