[ros-diffs] [jmorlan] 39879: Make CALL command do another round of %-variable substitutions.

jmorlan at svn.reactos.org jmorlan at svn.reactos.org
Thu Mar 5 06:10:11 CET 2009


Author: jmorlan
Date: Thu Mar  5 08:10:10 2009
New Revision: 39879

URL: http://svn.reactos.org/svn/reactos?rev=39879&view=rev
Log:
Make CALL command do another round of %-variable substitutions.

Modified:
    trunk/reactos/base/shell/cmd/call.c
    trunk/reactos/base/shell/cmd/cmd.h

Modified: trunk/reactos/base/shell/cmd/call.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/call.c?rev=39879&r1=39878&r2=39879&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/call.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/call.c [iso-8859-1] Thu Mar  5 08:10:10 2009
@@ -33,15 +33,12 @@
 
 /*
  * Perform CALL command.
- *
- * Allocate a new batch context and add it to the current chain.
- * Call parsecommandline passing in our param string
- * If No batch file was opened then remove our newly allocted
- * context block.
  */
 
 INT cmd_call (LPTSTR param)
 {
+	TCHAR line[CMDLINE_LENGTH];
+
 	TRACE ("cmd_call: (\'%s\')\n", debugstr_aw(param));
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
@@ -49,13 +46,22 @@
 		return 0;
 	}
 
+	/* Do a second round of %-variable substitutions */
+	if (!SubstituteVars(param, line, _T('%')))
+		return nErrorLevel = 1;
+
+	param = line;
+	while (_istspace(*param))
+		param++;
 	if (*param == _T(':') && (bc))
 	{
+		/* CALL :label - call a subroutine of the current batch file */
 		TCHAR *first = param;
 		while (*param && !_istspace(*param))
 			param++;
 		if (*param)
 		{
+			/* Separate label and arguments */
 			*param++ = _T('\0');
 			while (_istspace(*param))
 				param++;

Modified: trunk/reactos/base/shell/cmd/cmd.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.h?rev=39879&r1=39878&r2=39879&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] Thu Mar  5 08:10:10 2009
@@ -102,6 +102,7 @@
 LPCTSTR GetEnvVarOrSpecial ( LPCTSTR varName );
 VOID AddBreakHandler (VOID);
 VOID RemoveBreakHandler (VOID);
+BOOL SubstituteVars(TCHAR *Src, TCHAR *Dest, TCHAR Delim);
 BOOL SubstituteForVars(TCHAR *Src, TCHAR *Dest);
 LPTSTR DoDelayedExpansion(LPTSTR Line);
 BOOL DoCommand (LPTSTR line, struct _PARSED_COMMAND *Cmd);



More information about the Ros-diffs mailing list