126{
132 DWORD TokensMask = (1 << 1);
133#ifdef MSCMD_FOR_QUIRKS
135 DWORD RemainderVar = 0;
136#else
138#endif
144
146 {
149 if (*Param ==
_T(
'"') || *Param ==
_T(
'\''))
150 Quote = *Param++;
151
152 while (*Param && *Param != Quote)
153 {
154 if (*Param <=
_T(
' '))
155 {
156 Param++;
157 }
159 {
160 Param += 7;
161
162
163
164
165
166 Delims = Param;
168 while (*Param && *Param != Quote)
169 {
170 if (*Param ==
_T(
' '))
171 {
172 PTCHAR FirstSpace = Param;
174
175 if (*Param && *Param != Quote)
176 {
177
178 DelimsEndPtr = FirstSpace;
179 }
180 break;
181 }
182 Param++;
183 }
184 if (*Param == Quote)
185 {
186
187 DelimsEndPtr = Param++;
188 }
189 }
191 {
192 Param += 4;
193
194
195 Eol = *Param;
197 Param++;
198 }
200 {
201
205 }
207 {
208#ifdef MSCMD_FOR_QUIRKS
209 DWORD NumToksInSpec = 0;
210#endif
211 Param += 7;
212
213
214
215
216
217
218
219
220 TokensMask = 0;
221#ifdef MSCMD_FOR_QUIRKS
222 NumToksInSpec = 0;
223
224
225#else
226 NumTokens = 0;
227#endif
228
229 while (*Param && *Param != Quote && *Param !=
_T(
'*'))
230 {
233#ifdef MSCMD_FOR_QUIRKS
235#else
237#endif
239 if (*Param ==
_T(
'-'))
240 {
241
242 Last =
_tcstol(Param + 1, &Param, 0);
243#ifdef MSCMD_FOR_QUIRKS
244
245 if (Last < 1)
246#else
247 if ((Last <
First) || (Last > 31))
248#endif
250 }
251#ifdef MSCMD_FOR_QUIRKS
252
253 if ((
First <= Last) && (Last <= 31))
254 {
255#endif
256 TokensMask |= (2 << Last) - (1 <<
First);
257#ifdef MSCMD_FOR_QUIRKS
258 NumToksInSpec += (Last -
First + 1);
259 }
260#endif
261
262 if (*Param !=
_T(
','))
263 break;
264 Param++;
265 }
266
267
268
269 if (*Param ==
_T(
'*'))
270 {
271#ifdef MSCMD_FOR_QUIRKS
272 RemainderVar = ++NumToksInSpec;
273#else
274 ++NumTokens;
275#endif
276 Param++;
277 }
278#ifdef MSCMD_FOR_QUIRKS
279 NumTokens =
max(NumTokens, NumToksInSpec);
280#endif
281 }
283 {
284 Param += 7;
285
286 StringQuote =
_T(
'\'');
287 CommandQuote =
_T(
'`');
288
290 Param++;
291 }
292 else
293 {
296 return 1;
297 }
298 }
299 }
300
301#ifdef MSCMD_FOR_QUIRKS
302
304
306 {
308 }
309 else
310 {
313 {
315 return 1;
316 }
317 }
318#else
319
320
322 for (NumTokens = 1; NumTokens < 32; ++NumTokens)
323 fc->
varcount += (TokensMask >> NumTokens) & 1;
325#endif
326
327 if (*
List == StringQuote || *
List == CommandQuote)
328 {
329
332 goto single_element;
333 }
334
335
338 {
342 single_element:
343
344 if (*
Start == StringQuote && End[-1] == StringQuote)
345 {
346
349 }
350 else if (*
Start == CommandQuote && End[-1] == CommandQuote)
351 {
352
353
354
355
356
359 if (!InputFile)
360 {
362 Ret = 1;
363 goto Quit;
364 }
367 }
368 else
369 {
370
375 *End = Temp;
376 if (!InputFile)
377 {
379 Ret = 1;
380 goto Quit;
381 }
384 }
385
386 if (!FullInput)
387 {
389 Ret = 1;
390 goto Quit;
391 }
392
393
394 if (DelimsEndPtr)
395 {
396 DelimsEndChr = *DelimsEndPtr;
397 *DelimsEndPtr =
_T(
'\0');
398 }
399
400
404 {
405 DWORD RemainingTokens = TokensMask;
407
409#ifdef MSCMD_FOR_QUIRKS
411#endif
412
416
417 if (--Skip >= 0)
418 continue;
419
420
423 continue;
424
425
426
427
428 while (*
In && ((RemainingTokens >>= 1) != 0))
429 {
430
431 if (RemainingTokens & 1)
432 {
433#ifdef MSCMD_FOR_QUIRKS
434 --NumTokens;
435#endif
437 }
438
440
442 {
445 }
446 }
447
448
450#ifdef MSCMD_FOR_QUIRKS
451 if (RemainderVar && (
fc->
varcount - NumTokens + 1 == RemainderVar))
452#endif
453 {
454
455
456
458 }
459
460
463 }
464
465
466 if (DelimsEndPtr)
467 *DelimsEndPtr = DelimsEndChr;
468
470 }
471
472Quit:
473#ifdef MSCMD_FOR_QUIRKS
476#endif
477
478 return Ret;
479}
VOID error_bad_command(PCTSTR s)
VOID error_out_of_memory(VOID)
VOID error_syntax(PCTSTR s)
VOID error_sfile_not_found(PCTSTR s)
static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
_Check_return_opt_ _CRTIMP int __cdecl _pclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)