support blocks ( ... )

support parsing of env vars like %TIMERAW:~0,2%
there is still room for improvement... 

svn path=/trunk/; revision=31903
This commit is contained in:
Christoph von Wittich 2008-01-20 14:29:18 +00:00
parent 95ed37888e
commit 67ed022d72
4 changed files with 68 additions and 12 deletions

View file

@ -272,6 +272,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN);
bc->bEcho = bEcho; /* Preserve echo across batch calls */
bc->shiftlevel = 0;
bc->bCmdBlock = FALSE;
bc->ffind = NULL;
bc->forvar = _T('\0');
@ -453,6 +454,18 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
*++ip = _T('\0');
/* cmd block over multiple lines (..) */
if (bc->bCmdBlock)
{
if (*first == _T(')'))
{
bc->bCmdBlock = FALSE;
continue;
}
if (!bc->bExecuteBlock)
continue;
}
/* ignore labels and empty lines */
if (*first == _T(':') || *first == 0)
continue;