translate %errorlevel% to a value when it pass at command line. Now is errorlevel implement as it should. left todo check all cmd command that they are setting right value
Modified: trunk/reactos/subsys/system/cmd/cmd.c

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-07-06 11:31:03 UTC (rev 16451)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-07-06 12:20:57 UTC (rev 16452)
@@ -134,6 +134,9 @@
  *
  *    06-May-2005 (Klemens Friedl <frik85@gmail.com>)
  *        Add 'help' command (list all commands plus description)
+ *
+ *    06-jul-2005 (Magnus Olsen <magnus@greatlord.com>)
+ *        translate '%errorlevel%' to the internal value.
  */
 
 #include "precomp.h"
@@ -982,23 +985,36 @@
 						{
 							TCHAR evar[512];
 							*tp = _T('\0');
-
+            
 							/* FIXME: This is just a quick hack!! */
-							/* Do a proper memory allocation!! */
-							if (GetEnvironmentVariable (ip, evar, 512))
-								cp = _stpcpy (cp, evar);
-
+							/* Do a proper memory allocation!! */                                 
+                          
+              if (_tcsicmp(ip,_T("errorlevel")) ==0)
+              {       
+                memset(evar,0,512 * sizeof(TCHAR));
+                _itot(nErrorLevel,evar,10);        
+                cp = _stpcpy (cp, evar);
+              } 
+							else if (GetEnvironmentVariable (ip, evar, 512))
+              {
+								 cp = _stpcpy (cp, evar);
+              }
+              
 							ip = tp + 1;
 						}
 						else
 						{
 							*cp++ = _T('%');
-						}
+						}              
+             
 						break;
 				}
 				continue;
 			}
 
+
+     
+
 			if (_istcntrl (*ip))
 				*ip = _T(' ');
 			*cp++ = *ip++;
@@ -1007,10 +1023,10 @@
 		*cp = _T('\0');
 
 		/* strip trailing spaces */
-		while ((--cp >= commandline) && _istspace (*cp));
+		while ((--cp >= commandline) && _istspace (*cp));     
 
 		*(cp + 1) = _T('\0');
-
+   
 		/* JPP 19980807 */
 		/* Echo batch file line */
 		if (bEchoThisLine)