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=…
==============================================================================
--- 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=3…
==============================================================================
--- 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);