adding %RANDOM% example how to use it echo %random%
Modified: trunk/reactos/subsys/system/cmd/cmd.c
Modified: trunk/reactos/subsys/system/cmd/precomp.h
_____
Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c 2005-07-07 16:45:42 UTC
(rev 16488)
+++ trunk/reactos/subsys/system/cmd/cmd.c 2005-07-07 17:09:56 UTC
(rev 16489)
@@ -1006,7 +1006,8 @@
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL,
szTime, sizeof(szTime));
cp = _stpcpy (cp, szTime);
}
-
+
+ /* %DATE% */
else if (_tcsicmp(ip,_T("date")) ==0)
{
TCHAR szDate[40];
@@ -1015,9 +1016,16 @@
cp = _stpcpy (cp, szDate);
cp = _stpcpy (cp, _T(" "));
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL,
NULL, szDate, sizeof (szDate));
-
cp = _stpcpy (cp, szDate);
+ }
+ /* %RANDOM% */
+ else if (_tcsicmp(ip,_T("random")) ==0)
+ {
+ TCHAR szRand[40];
+ /* Get random number */
+ _itot(rand(),szRand,10);
+ cp = _stpcpy (cp, szRand);
}
_____
Modified: trunk/reactos/subsys/system/cmd/precomp.h
--- trunk/reactos/subsys/system/cmd/precomp.h 2005-07-07 16:45:42 UTC
(rev 16488)
+++ trunk/reactos/subsys/system/cmd/precomp.h 2005-07-07 17:09:56 UTC
(rev 16489)
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
+#include <time.h>
#include "cmd.h"
#include "config.h"
Show replies by date