expand %* to batch file params.

bug: #1629

svn path=/trunk/; revision=22683
This commit is contained in:
Brandon Turner 2006-06-29 02:48:52 +00:00
parent bbfd29210c
commit c6661f1f9e
3 changed files with 32 additions and 0 deletions

View file

@ -272,6 +272,11 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
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"));

View file

@ -15,6 +15,7 @@ typedef struct tagBATCHCONTEXT
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 */

View file

@ -1274,6 +1274,32 @@ GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA )
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 ) )