mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:46:17 +00:00
add %DATE% example echo %date% are working now. Bugfix date so it print out the week days names.
svn path=/trunk/; revision=16485
This commit is contained in:
parent
d7990aa664
commit
4e39fcafa0
2 changed files with 36 additions and 12 deletions
|
@ -990,10 +990,8 @@ ProcessInput (BOOL bFlag)
|
|||
*tp = _T('\0');
|
||||
|
||||
/* FIXME: Correct error handling when it can not alloc memmory */
|
||||
evar = malloc ( size * sizeof(TCHAR));
|
||||
if (evar==NULL)
|
||||
return 1;
|
||||
|
||||
|
||||
/* %CD% */
|
||||
if (_tcsicmp(ip,_T("cd")) ==0)
|
||||
{
|
||||
TCHAR szPath[MAX_PATH];
|
||||
|
@ -1001,21 +999,47 @@ ProcessInput (BOOL bFlag)
|
|||
cp = _stpcpy (cp, szPath);
|
||||
}
|
||||
|
||||
/* %TIME% */
|
||||
else if (_tcsicmp(ip,_T("time")) ==0)
|
||||
{
|
||||
TCHAR szTime[40];
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL, szTime, sizeof(szTime));
|
||||
cp = _stpcpy (cp, szTime);
|
||||
}
|
||||
|
||||
else if (_tcsicmp(ip,_T("date")) ==0)
|
||||
{
|
||||
TCHAR szDate[40];
|
||||
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), szDate, sizeof (szDate));
|
||||
cp = _stpcpy (cp, szDate);
|
||||
cp = _stpcpy (cp, _T(" "));
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szDate, sizeof (szDate));
|
||||
|
||||
cp = _stpcpy (cp, szDate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* %ERRORLEVEL% */
|
||||
else if (_tcsicmp(ip,_T("errorlevel")) ==0)
|
||||
{
|
||||
{
|
||||
evar = malloc ( size * sizeof(TCHAR));
|
||||
if (evar==NULL)
|
||||
return 1;
|
||||
|
||||
memset(evar,0,512 * sizeof(TCHAR));
|
||||
_itot(nErrorLevel,evar,10);
|
||||
cp = _stpcpy (cp, evar);
|
||||
|
||||
free(evar);
|
||||
}
|
||||
else
|
||||
{
|
||||
evar = malloc ( size * sizeof(TCHAR));
|
||||
if (evar==NULL)
|
||||
return 1;
|
||||
|
||||
size = GetEnvironmentVariable (ip, evar, size);
|
||||
if (size!=0)
|
||||
{
|
||||
|
@ -1030,12 +1054,10 @@ ProcessInput (BOOL bFlag)
|
|||
{
|
||||
cp = _stpcpy (cp, evar);
|
||||
}
|
||||
}
|
||||
|
||||
if (evar!=NULL)
|
||||
{
|
||||
free(evar);
|
||||
}
|
||||
}
|
||||
|
||||
ip = tp + 1;
|
||||
|
||||
}
|
||||
|
|
|
@ -58,11 +58,13 @@ VOID InitLocale (VOID)
|
|||
|
||||
VOID PrintDate (VOID)
|
||||
{
|
||||
TCHAR szDateDay[32];
|
||||
TCHAR szDate[32];
|
||||
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
|
||||
szDate, sizeof (szDate));
|
||||
ConOutPrintf(_T("%s"), szDate);
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), szDateDay, sizeof (szDateDay));
|
||||
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,szDate, sizeof (szDate));
|
||||
ConOutPrintf(_T("%s %s"),szDateDay, szDate);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue