(hopefully) last bugfix to set /a - assignment works again
Modified: trunk/reactos/subsys/system/cmd/set.c

Modified: trunk/reactos/subsys/system/cmd/set.c
--- trunk/reactos/subsys/system/cmd/set.c	2005-09-18 17:33:11 UTC (rev 17915)
+++ trunk/reactos/subsys/system/cmd/set.c	2005-09-18 17:52:28 UTC (rev 17916)
@@ -408,36 +408,22 @@
 	if ( identlen )
 	{
 		if ( *p == _T('=') )
-			op = *p, p++;
+			op = *p, p = skip_ws(p+1);
 		else if ( _tcschr ( _T("*/%+-&^|"), *p ) && p[1] == _T('=') )
-			op = *p, p += 2;
+			op = *p, p = skip_ws(p+2);
 		else if ( _tcschr ( _T("<>"), *p ) && *p == p[1] && p[2] == _T('=') )
-			op = *p, p += 3;
-		else
-		{
-			_tprintf ( _T("Missing operand.\n") );
-			return FALSE;
-		}
-		p = skip_ws ( p );
+			op = *p, p = skip_ws(p+3);
 	}
 
 	/* allow to chain multiple assignments, such as: a=b=1 */
 	if ( ident && op )
 	{
-		if ( !seta_assignment ( &p, &exprval ) )
-			return FALSE;
-	}
-	else
-	{
-		if ( !seta_expr ( &p, &exprval ) )
-			return FALSE;
-	}
-
-	if ( identlen )
-	{
 		INT identval;
 		LPTSTR buf;
 
+		if ( !seta_assignment ( &p, &exprval ) )
+			return FALSE;
+
 		if ( !seta_identval ( ident, &identval ) )
 			identval = 0;
 		switch ( op )
@@ -460,6 +446,13 @@
 		SetEnvironmentVariable ( ident, buf ); // TODO FIXME - check return value
 		exprval = identval;
 	}
+	else
+	{
+		/* restore p in case we found an ident but not an op */
+		p = *p_;
+		if ( !seta_expr ( &p, &exprval ) )
+			return FALSE;
+	}
 
 	*result = exprval;
 	*p_ = p;