mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[CMD] DATE: Simplify the input loop, based on the TIME command.
Set also the ERRORLEVEL in case of error.
This commit is contained in:
parent
a151893351
commit
80844dc185
1 changed files with 12 additions and 21 deletions
|
@ -212,9 +212,9 @@ INT cmd_date(LPTSTR param)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nDateString == -1)
|
|
||||||
{
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
{
|
||||||
|
if (nDateString == -1)
|
||||||
{
|
{
|
||||||
PrintDateString();
|
PrintDateString();
|
||||||
ConInString(szDate, ARRAYSIZE(szDate));
|
ConInString(szDate, ARRAYSIZE(szDate));
|
||||||
|
@ -229,30 +229,21 @@ INT cmd_date(LPTSTR param)
|
||||||
freep(arg);
|
freep(arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ConErrResPuts(STRING_DATE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ParseDate(arg[nDateString]))
|
if (ParseDate(arg[nDateString]))
|
||||||
{
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
ConErrResPuts(STRING_DATE_ERROR);
|
|
||||||
|
|
||||||
PrintDateString();
|
|
||||||
ConInString(szDate, ARRAYSIZE(szDate));
|
|
||||||
|
|
||||||
while (*szDate && szDate[_tcslen(szDate) - 1] < _T(' '))
|
|
||||||
szDate[_tcslen(szDate) - 1] = _T('\0');
|
|
||||||
|
|
||||||
if (ParseDate(szDate))
|
|
||||||
{
|
{
|
||||||
freep(arg);
|
freep(arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Force input the next time around */
|
||||||
|
nDateString = -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
ConErrResPuts(STRING_DATE_ERROR);
|
||||||
|
nErrorLevel = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
freep(arg);
|
freep(arg);
|
||||||
|
|
Loading…
Reference in a new issue