37#define MSCMD_FOR_QUIRKS
70 InQuotes ^= (*
p++ ==
_T(
'"'));
77#define RunInstance(Cmd) \
78 ExecuteCommandWithEcho((Cmd)->Subcommands)
83 (bCtrlBreak || (fc != (Cmd)->For.Context))
85#define ExitingOrGoto(Cmd) \
86 (Exiting(Cmd) || (bc && bc->current == NULL))
98 WARN(
"Cannot allocate memory for Contents!\n");
105 while (
Len + CharsRead >= AllocLen)
107 LPTSTR OldContents = Contents;
111 WARN(
"Cannot reallocate memory for Contents!\n");
120 Contents[
Len] =
_T(
'\0');
132 DWORD TokensMask = (1 << 1);
133#ifdef MSCMD_FOR_QUIRKS
135 DWORD RemainderVar = 0;
149 if (*Param ==
_T(
'"') || *Param ==
_T(
'\''))
152 while (*Param && *Param != Quote)
154 if (*Param <=
_T(
' '))
168 while (*Param && *Param != Quote)
170 if (*Param ==
_T(
' '))
172 PTCHAR FirstSpace = Param;
175 if (*Param && *Param != Quote)
178 DelimsEndPtr = FirstSpace;
187 DelimsEndPtr = Param++;
208#ifdef MSCMD_FOR_QUIRKS
209 DWORD NumToksInSpec = 0;
221#ifdef MSCMD_FOR_QUIRKS
229 while (*Param && *Param != Quote && *Param !=
_T(
'*'))
233#ifdef MSCMD_FOR_QUIRKS
239 if (*Param ==
_T(
'-'))
242 Last =
_tcstol(Param + 1, &Param, 0);
243#ifdef MSCMD_FOR_QUIRKS
247 if ((Last <
First) || (Last > 31))
251#ifdef MSCMD_FOR_QUIRKS
253 if ((
First <= Last) && (Last <= 31))
256 TokensMask |= (2 << Last) - (1 <<
First);
257#ifdef MSCMD_FOR_QUIRKS
258 NumToksInSpec += (Last -
First + 1);
262 if (*Param !=
_T(
','))
269 if (*Param ==
_T(
'*'))
271#ifdef MSCMD_FOR_QUIRKS
272 RemainderVar = ++NumToksInSpec;
278#ifdef MSCMD_FOR_QUIRKS
279 NumTokens =
max(NumTokens, NumToksInSpec);
286 StringQuote =
_T(
'\'');
287 CommandQuote =
_T(
'`');
301#ifdef MSCMD_FOR_QUIRKS
322 for (NumTokens = 1; NumTokens < 32; ++NumTokens)
323 fc->
varcount += (TokensMask >> NumTokens) & 1;
327 if (*
List == StringQuote || *
List == CommandQuote)
344 if (*
Start == StringQuote && End[-1] == StringQuote)
350 else if (*
Start == CommandQuote && End[-1] == CommandQuote)
396 DelimsEndChr = *DelimsEndPtr;
397 *DelimsEndPtr =
_T(
'\0');
405 DWORD RemainingTokens = TokensMask;
409#ifdef MSCMD_FOR_QUIRKS
428 while (*
In && ((RemainingTokens >>= 1) != 0))
431 if (RemainingTokens & 1)
433#ifdef MSCMD_FOR_QUIRKS
450#ifdef MSCMD_FOR_QUIRKS
451 if (RemainderVar && (
fc->
varcount - NumTokens + 1 == RemainderVar))
467 *DelimsEndPtr = DelimsEndChr;
473#ifdef MSCMD_FOR_QUIRKS
523 BufPos[End -
Start] =
_T(
'\0');
536 FilePart = FilePart ? FilePart + 1 : BufPos;
544 if (
_tcscmp(w32fd.cFileName,
_T(
".")) == 0 ||
547 _tcscpy(FilePart, w32fd.cFileName);
567 if (BufPos[-1] !=
_T(
'\\'))
569 *BufPos++ =
_T(
'\\');
589 if (
_tcscmp(w32fd.cFileName,
_T(
".")) == 0 ||
620 WARN(
"Cannot allocate memory for lpNew!\n");
627 lpNew->
values = &BufferPtr;
629 Cmd->For.Context = lpNew;
PTSTR DoDelayedExpansion(IN PCTSTR Line)
LPTSTR _stpcpy(LPTSTR, LPCTSTR)
VOID ParseErrorEx(IN PCTSTR s)
VOID error_bad_command(PCTSTR s)
VOID error_out_of_memory(VOID)
VOID error_syntax(PCTSTR s)
VOID error_sfile_not_found(PCTSTR s)
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
static VOID StripQuotes(LPSTR in)
#define cmd_realloc(ptr, size)
#define INVALID_HANDLE_VALUE
BOOL WINAPI FindClose(HANDLE hFindFile)
#define ExitingOrGoto(Cmd)
static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
INT cmd_for(LPTSTR param)
static INT ForLoop(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer)
static INT ForDir(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer, TCHAR *BufPos)
static INT ForF(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer)
static BOOL GetNextElement(TCHAR **pStart, TCHAR **pEnd)
INT ExecuteFor(PARSED_COMMAND *Cmd)
static INT ForRecursive(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer, TCHAR *BufPos)
GLenum const GLfloat * params
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_opt_ _CRTIMP int __cdecl _pclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define memcpy(s1, s2, n)
#define FILE_ATTRIBUTE_HIDDEN
#define FILE_ATTRIBUTE_DIRECTORY
struct _FOR_CONTEXT * prev
_Must_inspect_result_ _In_ WDFCMRESLIST List