mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 00:23:10 +00:00
* Create a branch for USB experiments.
svn path=/branches/usb-experiments/; revision=72629
This commit is contained in:
parent
28d8ba0d3e
commit
0ee830d7a4
23049 changed files with 0 additions and 1313991 deletions
83
base/shell/cmd/call.c
Normal file
83
base/shell/cmd/call.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* CALL.C - call internal batch command.
|
||||
*
|
||||
*
|
||||
* History:
|
||||
*
|
||||
* 16 Jul 1998 (Hans B Pufal)
|
||||
* started.
|
||||
*
|
||||
* 16 Jul 1998 (John P Price)
|
||||
* Seperated commands into individual files.
|
||||
*
|
||||
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
|
||||
* added config.h include
|
||||
*
|
||||
* 04-Aug-1998 (Hans B Pufal)
|
||||
* added lines to initialize for pointers (HBP004) This fixed the
|
||||
* lock-up that happened sometimes when calling a batch file from
|
||||
* another batch file.
|
||||
*
|
||||
* 07-Jan-1999 (Eric Kohl)
|
||||
* Added help text ("call /?") and cleaned up.
|
||||
*
|
||||
* 20-Jan-1999 (Eric Kohl)
|
||||
* Unicode and redirection safe!
|
||||
*
|
||||
* 02-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
|
||||
* Remove all hardcoded strings in En.rc
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
/*
|
||||
* Perform CALL command.
|
||||
*/
|
||||
|
||||
INT cmd_call (LPTSTR param)
|
||||
{
|
||||
TCHAR line[CMDLINE_LENGTH + 1];
|
||||
TCHAR *first;
|
||||
BOOL bInQuote = FALSE;
|
||||
|
||||
TRACE ("cmd_call: (\'%s\')\n", debugstr_aw(param));
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_CALL_HELP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do a second round of %-variable substitutions */
|
||||
if (!SubstituteVars(param, line, _T('%')))
|
||||
return nErrorLevel = 1;
|
||||
|
||||
/* Find start and end of first word */
|
||||
first = line;
|
||||
while (_istspace(*first))
|
||||
first++;
|
||||
|
||||
for (param = first; *param; param++)
|
||||
{
|
||||
if (!bInQuote && (_istspace(*param) || _tcschr(_T(",;="), *param)))
|
||||
break;
|
||||
bInQuote ^= (*param == _T('"'));
|
||||
}
|
||||
|
||||
/* Separate first word from rest of line */
|
||||
memmove(param + 1, param, (_tcslen(param) + 1) * sizeof(TCHAR));
|
||||
*param++ = _T('\0');
|
||||
|
||||
if (*first == _T(':') && (bc))
|
||||
{
|
||||
/* CALL :label - call a subroutine of the current batch file */
|
||||
while (*param == _T(' '))
|
||||
param++;
|
||||
nErrorLevel = Batch(bc->BatchFilePath, first, param, NULL);
|
||||
return nErrorLevel;
|
||||
}
|
||||
|
||||
nErrorLevel = DoCommand(first, param, NULL);
|
||||
return nErrorLevel;
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue