Author: turner
Date: Thu Jun 29 06:48:52 2006
New Revision: 22683
URL:
http://svn.reactos.org/svn/reactos?rev=22683&view=rev
Log:
expand %* to batch file params.
bug: #1629
Modified:
trunk/reactos/base/shell/cmd/batch.c
trunk/reactos/base/shell/cmd/batch.h
trunk/reactos/base/shell/cmd/cmd.c
Modified: trunk/reactos/base/shell/cmd/batch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.c?rev…
==============================================================================
--- trunk/reactos/base/shell/cmd/batch.c (original)
+++ trunk/reactos/base/shell/cmd/batch.c Thu Jun 29 06:48:52 2006
@@ -272,6 +272,11 @@
bc->forvar = _T('\0');
bc->forproto = NULL;
bc->params = BatchParams (firstword, param);
+ //
+ // Allocate enough memory to hold the params and copy them over without
modifications
+ //
+ bc->raw_params = malloc(_tcslen(param));
+ _tcscpy(bc->raw_params,param);
#ifdef _DEBUG
DebugPrintf (_T("Batch: returns TRUE\n"));
Modified: trunk/reactos/base/shell/cmd/batch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.h?rev…
==============================================================================
--- trunk/reactos/base/shell/cmd/batch.h (original)
+++ trunk/reactos/base/shell/cmd/batch.h Thu Jun 29 06:48:52 2006
@@ -15,6 +15,7 @@
HANDLE hBatchFile;
LPTSTR forproto;
LPTSTR params;
+ LPTSTR raw_params; /* Holds the raw params given by the input */
INT shiftlevel;
BOOL bEcho; /* Preserve echo flag across batch calls */
HANDLE hFind; /* Preserve find handle when doing a for */
Modified: trunk/reactos/base/shell/cmd/cmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=2…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c (original)
+++ trunk/reactos/base/shell/cmd/cmd.c Thu Jun 29 06:48:52 2006
@@ -1274,6 +1274,32 @@
if ( varNameLen )
*varNameLen = 2;
return ret;
+
+ case _T('*'):
+ if(bc == NULL)
+ {
+ //
+ // No batch file to see here, move along
+ //
+ if ( !GrowIfNecessary ( 3, &ret, &retlen ) )
+ return NULL;
+ ret[0] = _T('%');
+ ret[1] = _T('*');
+ ret[2] = 0;
+ if ( varNameLen )
+ *varNameLen = 2;
+ return ret;
+ }
+
+ //
+ // Copy over the raw params(not including the batch file name
+ //
+ if ( !GrowIfNecessary ( _tcslen(bc->raw_params)+1, &ret, &retlen ) )
+ return NULL;
+ if ( varNameLen )
+ *varNameLen = 2;
+ _tcscpy ( ret, bc->raw_params );
+ return ret;
case _T('%'):
if ( !GrowIfNecessary ( 2, &ret, &retlen ) )