ReactOS  0.4.14-dev-376-gaedba84
call.c File Reference
#include "precomp.h"
Include dependency graph for call.c:

Go to the source code of this file.

Functions

INT cmd_call (LPTSTR param)
 

Function Documentation

◆ cmd_call()

INT cmd_call ( LPTSTR  param)

Definition at line 37 of file call.c.

38 {
40  TCHAR *first;
41  BOOL bInQuote = FALSE;
42 
43  TRACE ("cmd_call: (\'%s\')\n", debugstr_aw(param));
44  if (!_tcsncmp (param, _T("/?"), 2))
45  {
47  return 0;
48  }
49 
50  /* Do a second round of %-variable substitutions */
51  if (!SubstituteVars(param, line, _T('%')))
52  return (nErrorLevel = 1);
53 
54  /* Find start and end of first word */
55  first = line;
56  while (_istspace(*first))
57  first++;
58 
59  for (param = first; *param; param++)
60  {
61  if (!bInQuote && (_istspace(*param) || _tcschr(_T(",;="), *param)))
62  break;
63  bInQuote ^= (*param == _T('"'));
64  }
65 
66  /* Separate first word from rest of line */
67  memmove(param + 1, param, (_tcslen(param) + 1) * sizeof(TCHAR));
68  *param++ = _T('\0');
69 
70  if (*first == _T(':') && bc)
71  {
72  /* CALL :label - call a subroutine of the current batch file */
73  while (*param == _T(' '))
74  param++;
76  return nErrorLevel;
77  }
78 
80  return nErrorLevel;
81 }
INT nErrorLevel
Definition: cmd.c:157
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
LPBATCH_CONTEXT bc
Definition: batch.c:66
const GLint * first
Definition: glext.h:5794
#define debugstr_aw
Definition: precomp.h:43
#define CMDLINE_LENGTH
Definition: help.h:12
BOOL SubstituteVars(TCHAR *Src, TCHAR *Dest, TCHAR Delim)
Definition: cmd.c:1206
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
unsigned int BOOL
Definition: ntddk_ex.h:94
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
_TCHAR * _tcschr(const _TCHAR *s, _XINT c)
Definition: tcschr.h:4
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR BatchFilePath[MAX_PATH]
Definition: batch.h:14
GLfloat param
Definition: glext.h:5796
char line[200]
Definition: main.c:97
static VOID DoCommand(PCONSOLE_STATE State, LPSTR line)
Definition: cmdcons.c:1082
#define STRING_CALL_HELP
Definition: resource.h:71
#define _istspace
Definition: tchar.h:1504
int _tcsncmp(const _TCHAR *s1, const _TCHAR *s2, size_t n)
Definition: tcsncmp.h:9