mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[CMD] Syntax errors during parsing of batch parameters expansion, or FOR and IF commands, are fatal, and batch execution should stop.
- To this purpose use the ParseErrorEx() that correctly sets the bParseError flag, and return the partially-parsed command so that it gets echoed as well for diagnostics purposes (Windows-compatible). - Any other parameters specified after (or before) the '/?' switch for the FOR and IF commands, are considered fatal syntax errors as well, thus we employ the ParseErrorEx() as well.
This commit is contained in:
parent
6eb1cae348
commit
495c82ccde
3 changed files with 11 additions and 3 deletions
|
@ -1208,7 +1208,7 @@ GetBatchVar(TCHAR *varName, UINT *varNameLen)
|
|||
ret = GetEnhancedVar(&varNameEnd, FindArg);
|
||||
if (!ret)
|
||||
{
|
||||
error_syntax(varName);
|
||||
ParseErrorEx(varName);
|
||||
return NULL;
|
||||
}
|
||||
*varNameLen = varNameEnd - varName;
|
||||
|
@ -1267,6 +1267,14 @@ SubstituteVars(TCHAR *Src, TCHAR *Dest, TCHAR Delim)
|
|||
{
|
||||
UINT NameLen;
|
||||
Var = GetBatchVar(Src, &NameLen);
|
||||
if (!Var && bParseError)
|
||||
{
|
||||
/* Return the partially-parsed command to be
|
||||
* echoed for error diagnostics purposes. */
|
||||
APPEND1(Delim);
|
||||
APPEND(Src, DestEnd-Dest);
|
||||
return FALSE;
|
||||
}
|
||||
if (Var != NULL)
|
||||
{
|
||||
VarLength = _tcslen(Var);
|
||||
|
|
|
@ -44,7 +44,7 @@ INT cmd_for(LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
error_syntax(param);
|
||||
ParseErrorEx(param);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ INT cmd_if(LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
error_syntax(param);
|
||||
ParseErrorEx(param);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue