mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 02:43:38 +00:00
- Make IF command a special form; necessary to make nested multi-line IF blocks work properly
- Implement IF /I option, IF CMDEXTVERSION, and generic comparisons (EQU etc) - Make IF ERRORLEVEL return true if the errorlevel is greater than the number - Remove hacked support for multi-line IF blocks from batch.c svn path=/trunk/; revision=38280
This commit is contained in:
parent
940dd12ea9
commit
781ae61f03
7 changed files with 289 additions and 224 deletions
|
@ -269,7 +269,6 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, BOOL forcenew)
|
|||
SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN);
|
||||
bc->bEcho = bEcho; /* Preserve echo across batch calls */
|
||||
bc->shiftlevel = 0;
|
||||
bc->bCmdBlock = -1;
|
||||
|
||||
bc->ffind = NULL;
|
||||
bc->forvar = _T('\0');
|
||||
|
@ -445,39 +444,6 @@ LPTSTR ReadBatchLine ()
|
|||
|
||||
first = textline;
|
||||
|
||||
/* cmd block over multiple lines (..) */
|
||||
if (bc->bCmdBlock >= 0)
|
||||
{
|
||||
if (*first == _T(')'))
|
||||
{
|
||||
first++;
|
||||
/* Strip leading spaces and trailing space/control chars */
|
||||
while(_istspace (*first))
|
||||
first++;
|
||||
if ((_tcsncicmp (first, _T("else"), 4) == 0) && (_tcschr(first, _T('('))))
|
||||
{
|
||||
bc->bExecuteBlock[bc->bCmdBlock] = !bc->bExecuteBlock[bc->bCmdBlock];
|
||||
}
|
||||
else
|
||||
{
|
||||
bc->bCmdBlock--;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (bc->bCmdBlock < MAX_PATH)
|
||||
if (!bc->bExecuteBlock[bc->bCmdBlock])
|
||||
{
|
||||
/* increase the bCmdBlock count when there is another conditon which opens a new bracket */
|
||||
if ((_tcsncicmp (first, _T("if"), 2) == 0) && _tcschr(first, _T('(')))
|
||||
{
|
||||
bc->bCmdBlock++;
|
||||
if ((bc->bCmdBlock > 0) && (bc->bCmdBlock < MAX_PATH))
|
||||
bc->bExecuteBlock[bc->bCmdBlock] = bc->bExecuteBlock[bc->bCmdBlock - 1];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue