ReactOS  0.4.15-dev-985-gd905dd5
for.c
Go to the documentation of this file.
1 /*
2  * FOR.C - for internal batch command.
3  *
4  *
5  * History:
6  *
7  * 16-Jul-1998 (Hans B Pufal)
8  * Started.
9  *
10  * 16-Jul-1998 (John P Price)
11  * Separated commands into individual files.
12  *
13  * 19-Jul-1998 (Hans B Pufal)
14  * Implementation of FOR.
15  *
16  * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
17  * Added config.h include.
18  *
19  * 20-Jan-1999 (Eric Kohl)
20  * Unicode and redirection safe!
21  *
22  * 01-Sep-1999 (Eric Kohl)
23  * Added help text.
24  *
25  * 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.se>)
26  * Implemented preservation of echo flag. Some other for related
27  * code in other files fixed, too.
28  *
29  * 28-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
30  * Remove all hardcoded strings in En.rc
31  */
32 
33 #include "precomp.h"
34 
35 
36 /* FOR is a special command, so this function is only used for showing help now */
38 {
39  TRACE("cmd_for(\'%s\')\n", debugstr_aw(param));
40 
41  if (!_tcsncmp(param, _T("/?"), 2))
42  {
44  return 0;
45  }
46 
48  return 1;
49 }
50 
51 /* The stack of current FOR contexts.
52  * NULL when no FOR command is active */
54 
55 /* Get the next element of the FOR's list */
56 static BOOL GetNextElement(TCHAR **pStart, TCHAR **pEnd)
57 {
58  TCHAR *p = *pEnd;
59  BOOL InQuotes = FALSE;
60  while (_istspace(*p))
61  p++;
62  if (!*p)
63  return FALSE;
64  *pStart = p;
65  while (*p && (InQuotes || !_istspace(*p)))
66  InQuotes ^= (*p++ == _T('"'));
67  *pEnd = p;
68  return TRUE;
69 }
70 
71 /* Execute a single instance of a FOR command */
72 /* Just run the command (variable expansion is done in DoDelayedExpansion) */
73 #define RunInstance(Cmd) \
74  ExecuteCommandWithEcho((Cmd)->Subcommands)
75 
76 /* Check if this FOR should be terminated early */
77 #define Exiting(Cmd) \
78  /* Someone might have removed our context */ \
79  (bCtrlBreak || (fc != (Cmd)->For.Context))
80 /* Take also GOTO jumps into account */
81 #define ExitingOrGoto(Cmd) \
82  (Exiting(Cmd) || (bc && bc->current == NULL))
83 
84 /* Read the contents of a text file into memory,
85  * dynamically allocating enough space to hold it all */
86 static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
87 {
88  SIZE_T Len = 0;
89  SIZE_T AllocLen = 1000;
90 
91  LPTSTR Contents = cmd_alloc(AllocLen * sizeof(TCHAR));
92  if (!Contents)
93  {
94  WARN("Cannot allocate memory for Contents!\n");
95  return NULL;
96  }
97 
98  while (_fgetts(Buffer, CMDLINE_LENGTH, InputFile))
99  {
100  ULONG_PTR CharsRead = _tcslen(Buffer);
101  while (Len + CharsRead >= AllocLen)
102  {
103  LPTSTR OldContents = Contents;
104  Contents = cmd_realloc(Contents, (AllocLen *= 2) * sizeof(TCHAR));
105  if (!Contents)
106  {
107  WARN("Cannot reallocate memory for Contents!\n");
108  cmd_free(OldContents);
109  return NULL;
110  }
111  }
112  _tcscpy(&Contents[Len], Buffer);
113  Len += CharsRead;
114  }
115 
116  Contents[Len] = _T('\0');
117  return Contents;
118 }
119 
120 /* FOR /F: Parse the contents of each file */
122 {
123  LPTSTR Delims = _T(" \t");
124  TCHAR Eol = _T(';');
125  INT SkipLines = 0;
126  DWORD Tokens = (1 << 1);
127  BOOL RemainderVar = FALSE;
128  TCHAR StringQuote = _T('"');
129  TCHAR CommandQuote = _T('\'');
130  LPTSTR Variables[32];
131  TCHAR *Start, *End;
132  INT i;
133  INT Ret = 0;
134 
135  if (Cmd->For.Params)
136  {
137  TCHAR Quote = 0;
138  TCHAR *Param = Cmd->For.Params;
139  if (*Param == _T('"') || *Param == _T('\''))
140  Quote = *Param++;
141 
142  while (*Param && *Param != Quote)
143  {
144  if (*Param <= _T(' '))
145  {
146  Param++;
147  }
148  else if (_tcsnicmp(Param, _T("delims="), 7) == 0)
149  {
150  Param += 7;
151  /* delims=xxx: Specifies the list of characters that separate tokens */
152  Delims = Param;
153  while (*Param && *Param != Quote)
154  {
155  if (*Param == _T(' '))
156  {
157  TCHAR *FirstSpace = Param;
158  Param += _tcsspn(Param, _T(" "));
159  /* Exclude trailing spaces if this is not the last parameter */
160  if (*Param && *Param != Quote)
161  *FirstSpace = _T('\0');
162  break;
163  }
164  Param++;
165  }
166  if (*Param == Quote)
167  *Param++ = _T('\0');
168  }
169  else if (_tcsnicmp(Param, _T("eol="), 4) == 0)
170  {
171  Param += 4;
172  /* eol=c: Lines starting with this character (may be
173  * preceded by delimiters) are skipped. */
174  Eol = *Param;
175  if (Eol != _T('\0'))
176  Param++;
177  }
178  else if (_tcsnicmp(Param, _T("skip="), 5) == 0)
179  {
180  /* skip=n: Number of lines to skip at the beginning of each file */
181  SkipLines = _tcstol(Param + 5, &Param, 0);
182  if (SkipLines <= 0)
183  goto error;
184  }
185  else if (_tcsnicmp(Param, _T("tokens="), 7) == 0)
186  {
187  Param += 7;
188  /* tokens=x,y,m-n: List of token numbers (must be between
189  * 1 and 31) that will be assigned into variables. */
190  Tokens = 0;
191  while (*Param && *Param != Quote && *Param != _T('*'))
192  {
193  INT First = _tcstol(Param, &Param, 0);
194  INT Last = First;
195  if (First < 1)
196  goto error;
197  if (*Param == _T('-'))
198  {
199  /* It's a range of tokens */
200  Last = _tcstol(Param + 1, &Param, 0);
201  if (Last < First || Last > 31)
202  goto error;
203  }
204  Tokens |= (2 << Last) - (1 << First);
205 
206  if (*Param != _T(','))
207  break;
208  Param++;
209  }
210  /* With an asterisk at the end, an additional variable
211  * will be created to hold the remainder of the line
212  * (after the last token specified). */
213  if (*Param == _T('*'))
214  {
215  RemainderVar = TRUE;
216  Param++;
217  }
218  }
219  else if (_tcsnicmp(Param, _T("useback"), 7) == 0)
220  {
221  Param += 7;
222  /* usebackq: Use alternate quote characters */
223  StringQuote = _T('\'');
224  CommandQuote = _T('`');
225  /* Can be written as either "useback" or "usebackq" */
226  if (_totlower(*Param) == _T('q'))
227  Param++;
228  }
229  else
230  {
231  error:
232  error_syntax(Param);
233  return 1;
234  }
235  }
236  }
237 
238  /* Count how many variables will be set: one for each token,
239  * plus maybe one for the remainder */
240  fc->varcount = RemainderVar;
241  for (i = 1; i < 32; i++)
242  fc->varcount += (Tokens >> i & 1);
243  fc->values = Variables;
244 
245  if (*List == StringQuote || *List == CommandQuote)
246  {
247  /* Treat the entire "list" as one single element */
248  Start = List;
249  End = &List[_tcslen(List)];
250  goto single_element;
251  }
252 
253  /* Loop over each file */
254  End = List;
255  while (!ExitingOrGoto(Cmd) && GetNextElement(&Start, &End))
256  {
257  FILE *InputFile;
258  LPTSTR FullInput, In, NextLine;
259  INT Skip;
260  single_element:
261 
262  if (*Start == StringQuote && End[-1] == StringQuote)
263  {
264  /* Input given directly as a string */
265  End[-1] = _T('\0');
266  FullInput = cmd_dup(Start + 1);
267  }
268  else if (*Start == CommandQuote && End[-1] == CommandQuote)
269  {
270  /* Read input from a command */
271  End[-1] = _T('\0');
272  InputFile = _tpopen(Start + 1, _T("r"));
273  if (!InputFile)
274  {
276  return 1;
277  }
278  FullInput = ReadFileContents(InputFile, Buffer);
279  _pclose(InputFile);
280  }
281  else
282  {
283  /* Read input from a file */
284  TCHAR Temp = *End;
285  *End = _T('\0');
287  InputFile = _tfopen(Start, _T("r"));
288  *End = Temp;
289  if (!InputFile)
290  {
292  return 1;
293  }
294  FullInput = ReadFileContents(InputFile, Buffer);
295  fclose(InputFile);
296  }
297 
298  if (!FullInput)
299  {
301  return 1;
302  }
303 
304  /* Loop over the input line by line */
305  for (In = FullInput, Skip = SkipLines;
306  !ExitingOrGoto(Cmd) && (In != NULL);
307  In = NextLine)
308  {
309  DWORD RemainingTokens = Tokens;
310  LPTSTR *CurVar = Variables;
311 
312  NextLine = _tcschr(In, _T('\n'));
313  if (NextLine)
314  *NextLine++ = _T('\0');
315 
316  if (--Skip >= 0)
317  continue;
318 
319  /* Ignore lines where the first token starts with the eol character */
320  In += _tcsspn(In, Delims);
321  if (*In == Eol)
322  continue;
323 
324  while ((RemainingTokens >>= 1) != 0)
325  {
326  /* Save pointer to this token in a variable if requested */
327  if (RemainingTokens & 1)
328  *CurVar++ = In;
329  /* Find end of token */
330  In += _tcscspn(In, Delims);
331  /* NULL-terminate it and advance to next token */
332  if (*In)
333  {
334  *In++ = _T('\0');
335  In += _tcsspn(In, Delims);
336  }
337  }
338  /* Save pointer to remainder of line */
339  *CurVar = In;
340 
341  /* Don't run unless the line had enough tokens to fill at least one variable */
342  if (*Variables[0])
343  Ret = RunInstance(Cmd);
344  }
345 
346  cmd_free(FullInput);
347  }
348 
349  return Ret;
350 }
351 
352 /* FOR /L: Do a numeric loop */
354 {
355  enum { START, STEP, END };
356  INT params[3] = { 0, 0, 0 };
357  INT i;
358  INT Ret = 0;
359  TCHAR *Start, *End = List;
360 
361  for (i = 0; i < 3 && GetNextElement(&Start, &End); ++i)
362  params[i] = _tcstol(Start, NULL, 0);
363 
364  i = params[START];
365  /*
366  * Windows' CMD compatibility:
367  * Contrary to the other FOR-loops, FOR /L does not check
368  * whether a GOTO has been done, and will continue to loop.
369  */
370  while (!Exiting(Cmd) &&
371  (params[STEP] >= 0 ? (i <= params[END]) : (i >= params[END])))
372  {
373  _itot(i, Buffer, 10);
374  Ret = RunInstance(Cmd);
375  i += params[STEP];
376  }
377 
378  return Ret;
379 }
380 
381 /* Process a FOR in one directory. Stored in Buffer (up to BufPos) is a
382  * string which is prefixed to each element of the list. In a normal FOR
383  * it will be empty, but in FOR /R it will be the directory name. */
385 {
386  INT Ret = 0;
387  TCHAR *Start, *End = List;
388 
389  while (!ExitingOrGoto(Cmd) && GetNextElement(&Start, &End))
390  {
391  if (BufPos + (End - Start) > &Buffer[CMDLINE_LENGTH])
392  continue;
393  memcpy(BufPos, Start, (End - Start) * sizeof(TCHAR));
394  BufPos[End - Start] = _T('\0');
395 
396  if (_tcschr(BufPos, _T('?')) || _tcschr(BufPos, _T('*')))
397  {
398  WIN32_FIND_DATA w32fd;
399  HANDLE hFind;
400  TCHAR *FilePart;
401 
402  StripQuotes(BufPos);
403  hFind = FindFirstFile(Buffer, &w32fd);
404  if (hFind == INVALID_HANDLE_VALUE)
405  continue;
406  FilePart = _tcsrchr(BufPos, _T('\\'));
407  FilePart = FilePart ? FilePart + 1 : BufPos;
408  do
409  {
410  if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
411  continue;
412  if (!(w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
413  != !(Cmd->For.Switches & FOR_DIRS))
414  continue;
415  if (_tcscmp(w32fd.cFileName, _T(".")) == 0 ||
416  _tcscmp(w32fd.cFileName, _T("..")) == 0)
417  continue;
418  _tcscpy(FilePart, w32fd.cFileName);
419  Ret = RunInstance(Cmd);
420  } while (!ExitingOrGoto(Cmd) && FindNextFile(hFind, &w32fd));
421  FindClose(hFind);
422  }
423  else
424  {
425  Ret = RunInstance(Cmd);
426  }
427  }
428  return Ret;
429 }
430 
431 /* FOR /R: Process a FOR in each directory of a tree, recursively */
433 {
434  INT Ret = 0;
435  HANDLE hFind;
436  WIN32_FIND_DATA w32fd;
437 
438  if (BufPos[-1] != _T('\\'))
439  {
440  *BufPos++ = _T('\\');
441  *BufPos = _T('\0');
442  }
443 
444  Ret = ForDir(Cmd, List, Buffer, BufPos);
445 
446  /* NOTE (We don't apply Windows' CMD compatibility here):
447  * Windows' CMD does not check whether a GOTO has been done,
448  * and will continue to loop. */
449  if (ExitingOrGoto(Cmd))
450  return Ret;
451 
452  _tcscpy(BufPos, _T("*"));
453  hFind = FindFirstFile(Buffer, &w32fd);
454  if (hFind == INVALID_HANDLE_VALUE)
455  return Ret;
456  do
457  {
458  if (!(w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
459  continue;
460  if (_tcscmp(w32fd.cFileName, _T(".")) == 0 ||
461  _tcscmp(w32fd.cFileName, _T("..")) == 0)
462  continue;
463  Ret = ForRecursive(Cmd, List, Buffer, _stpcpy(BufPos, w32fd.cFileName));
464 
465  /* NOTE (We don't apply Windows' CMD compatibility here):
466  * Windows' CMD does not check whether a GOTO has been done,
467  * and will continue to loop. */
468  } while (!ExitingOrGoto(Cmd) && FindNextFile(hFind, &w32fd));
469  FindClose(hFind);
470 
471  return Ret;
472 }
473 
474 INT
476 {
477  INT Ret;
478  LPTSTR List;
479  PFOR_CONTEXT lpNew;
480  TCHAR Buffer[CMDLINE_LENGTH]; /* Buffer to hold the variable value */
481  LPTSTR BufferPtr = Buffer;
482 
483  List = DoDelayedExpansion(Cmd->For.List);
484  if (!List)
485  return 1;
486 
487  /* Create our FOR context */
488  lpNew = cmd_alloc(sizeof(FOR_CONTEXT));
489  if (!lpNew)
490  {
491  WARN("Cannot allocate memory for lpNew!\n");
492  cmd_free(List);
493  return 1;
494  }
495  lpNew->prev = fc;
496  lpNew->firstvar = Cmd->For.Variable;
497  lpNew->varcount = 1;
498  lpNew->values = &BufferPtr;
499 
500  Cmd->For.Context = lpNew;
501  fc = lpNew;
502 
503  /* Run the extended FOR syntax only if extensions are enabled */
504  if (bEnableExtensions)
505  {
506  if (Cmd->For.Switches & FOR_F)
507  {
508  Ret = ForF(Cmd, List, Buffer);
509  }
510  else if (Cmd->For.Switches & FOR_LOOP)
511  {
512  Ret = ForLoop(Cmd, List, Buffer);
513  }
514  else if (Cmd->For.Switches & FOR_RECURSIVE)
515  {
516  DWORD Len = GetFullPathName(Cmd->For.Params ? Cmd->For.Params : _T("."),
517  MAX_PATH, Buffer, NULL);
518  Ret = ForRecursive(Cmd, List, Buffer, &Buffer[Len]);
519  }
520  else
521  {
522  Ret = ForDir(Cmd, List, Buffer, Buffer);
523  }
524  }
525  else
526  {
527  Ret = ForDir(Cmd, List, Buffer, Buffer);
528  }
529 
530  /* Remove our context, unless someone already did that */
531  if (fc == lpNew)
532  fc = lpNew->prev;
533 
534  cmd_free(lpNew);
535  cmd_free(List);
536  return Ret;
537 }
538 
539 /* EOF */
#define FOR_DIRS
Definition: cmd.h:212
PFOR_CONTEXT fc
Definition: for.c:53
#define error(str)
Definition: mkdosfs.c:1605
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define TRUE
Definition: types.h:120
ULONG SkipLines(VOID)
Definition: parser.c:275
#define _tcstol
Definition: tchar.h:594
#define WARN(fmt,...)
Definition: debug.h:112
_Check_return_opt_ _CRTIMP int __cdecl _pclose(_Inout_ FILE *_File)
#define _fgetts
Definition: tchar.h:565
#define debugstr_aw
Definition: precomp.h:43
#define CMDLINE_LENGTH
Definition: help.h:12
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
static INT ForF(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer)
Definition: for.c:121
static VOID StripQuotes(LPSTR in)
Definition: cmdcons.c:116
int32_t INT
Definition: typedefs.h:58
#define FOR_F
Definition: cmd.h:213
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _itot
Definition: tchar.h:608
BOOLEAN NextLine(PCHAR LineBuffer, ULONG BufferSize, FILE *File)
Definition: parser.c:230
uint32_t ULONG_PTR
Definition: typedefs.h:65
WCHAR First[]
Definition: FormatMessage.c:11
#define STRING_FOR_HELP1
Definition: resource.h:128
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
Definition: glfuncs.h:248
LPTSTR _stpcpy(LPTSTR, LPCTSTR)
Definition: misc.c:460
#define FALSE
Definition: types.h:117
GLenum const GLfloat * params
Definition: glext.h:5645
unsigned int BOOL
Definition: ntddk_ex.h:94
#define STEP
Definition: input.c:1260
#define _tcsnicmp
Definition: xmlstorage.h:207
#define FOR_LOOP
Definition: cmd.h:214
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
VOID error_out_of_memory(VOID)
Definition: error.c:138
LPTSTR * values
Definition: batch.h:29
Definition: bufpool.h:45
INT ExecuteFor(PARSED_COMMAND *Cmd)
Definition: for.c:475
#define FindFirstFile
Definition: winbase.h:3622
_TCHAR * _tcschr(const _TCHAR *s, _XINT c)
Definition: tcschr.h:4
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
Definition: infcodes.c:25
char TCHAR
Definition: xmlstorage.h:189
static INT ForRecursive(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer, TCHAR *BufPos)
Definition: for.c:432
#define _tfopen
Definition: xmlstorage.h:196
#define _T(x)
Definition: vfdio.h:22
static BOOL GetNextElement(TCHAR **pStart, TCHAR **pEnd)
Definition: for.c:56
#define TRACE(s)
Definition: solgame.cpp:4
static INT ForLoop(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer)
Definition: for.c:353
LIST_ENTRY List
Definition: psmgr.c:57
#define FindNextFile
Definition: winbase.h:3628
#define ExitingOrGoto(Cmd)
Definition: for.c:81
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:34
#define RunInstance(Cmd)
Definition: for.c:73
LPTSTR DoDelayedExpansion(LPTSTR Line)
Definition: cmd.c:1477
static INT ForDir(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer, TCHAR *BufPos)
Definition: for.c:384
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID ParseErrorEx(IN PCTSTR s)
Definition: parser.c:115
#define Len
Definition: deflate.h:82
Definition: partlist.h:33
#define FOR_RECURSIVE
Definition: cmd.h:215
BOOL bEnableExtensions
Definition: cmd.c:161
#define cmd_realloc(ptr, size)
Definition: cmddbg.h:30
#define _totlower
Definition: tchar.h:1511
TCHAR firstvar
Definition: batch.h:27
VOID error_sfile_not_found(PCTSTR s)
Definition: error.c:100
struct _FOR_CONTEXT * prev
Definition: batch.h:26
Definition: sacdrv.h:277
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GetFullPathName
Definition: winbase.h:3661
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
UINT varcount
Definition: batch.h:28
#define _tcsspn
Definition: tchar.h:1414
Definition: infcodes.c:17
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define cmd_alloc(size)
Definition: cmddbg.h:29
#define cmd_free(ptr)
Definition: cmddbg.h:31
INT cmd_for(LPTSTR param)
Definition: for.c:37
VOID error_bad_command(PCTSTR s)
Definition: error.c:124
FILE * _tpopen(const _TCHAR *cm, const _TCHAR *md)
Definition: popen.c:38
#define cmd_dup(str)
Definition: cmddbg.h:32
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
#define _istspace
Definition: tchar.h:1504
static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
Definition: for.c:86
VOID error_syntax(PCTSTR s)
Definition: error.c:152
GLfloat GLfloat p
Definition: glext.h:8902
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
int _tcsncmp(const _TCHAR *s1, const _TCHAR *s2, size_t n)
Definition: tcsncmp.h:9
#define _tcscspn
Definition: tchar.h:1407
#define Exiting(Cmd)
Definition: for.c:77
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502