mirror of
https://github.com/reactos/reactos.git
synced 2024-07-11 23:25:09 +00:00
Andrey Janzen (virus126):
echo %date% on windows >=XP return '24.02.2007', not 'Sut 24.02.2007' fix & implement dynamic buffer svn path=/trunk/; revision=25919
This commit is contained in:
parent
4072d1c2a7
commit
a9d354b237
|
@ -1178,18 +1178,12 @@ GetEnvVarOrSpecial ( LPCTSTR varName )
|
|||
/* %DATE% */
|
||||
else if (_tcsicmp(varName,_T("date")) ==0)
|
||||
{
|
||||
LPTSTR tmp;
|
||||
|
||||
if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
|
||||
if ( !GrowIfNecessary ( GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0), &ret, &retlen ) )
|
||||
return NULL;
|
||||
size = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), ret, retlen );
|
||||
/* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */
|
||||
if ( !size )
|
||||
return NULL;
|
||||
tmp = ret + _tcslen(ret);
|
||||
*tmp++ = _T(' ');
|
||||
size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, tmp, retlen-(tmp-ret));
|
||||
/* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */
|
||||
|
||||
size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, ret, retlen);
|
||||
|
||||
if ( !size )
|
||||
return NULL;
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue