[CMD] DATE: Simplify the input loop, based on the TIME command.

Set also the ERRORLEVEL in case of error.
This commit is contained in:
Hermès Bélusca-Maïto 2020-07-12 18:23:57 +02:00
parent a151893351
commit 80844dc185
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -212,9 +212,9 @@ INT cmd_date(LPTSTR param)
return 0;
}
if (nDateString == -1)
while (TRUE)
{
while (TRUE)
if (nDateString == -1)
{
PrintDateString();
ConInString(szDate, ARRAYSIZE(szDate));
@ -229,30 +229,21 @@ INT cmd_date(LPTSTR param)
freep(arg);
return 0;
}
ConErrResPuts(STRING_DATE_ERROR);
}
}
else
{
if (!ParseDate(arg[nDateString]))
else
{
while (TRUE)
if (ParseDate(arg[nDateString]))
{
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);
return 0;
}
freep(arg);
return 0;
}
/* Force input the next time around */
nDateString = -1;
}
ConErrResPuts(STRING_DATE_ERROR);
nErrorLevel = 1;
}
freep(arg);