mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 13:21:39 +00:00
[CMD] Further code style and formatting fixes.
This commit is contained in:
parent
c93f511241
commit
ca912d7b36
7 changed files with 164 additions and 168 deletions
|
@ -28,32 +28,28 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
|
||||
/*
|
||||
* Perform GOTO command.
|
||||
*
|
||||
* Only valid if batch file current.
|
||||
*
|
||||
* Only valid when a batch context is active.
|
||||
*/
|
||||
|
||||
INT cmd_goto (LPTSTR param)
|
||||
INT cmd_goto(LPTSTR param)
|
||||
{
|
||||
LPTSTR tmp, tmp2;
|
||||
|
||||
TRACE ("cmd_goto (\'%s\')\n", debugstr_aw(param));
|
||||
TRACE("cmd_goto(\'%s\')\n", debugstr_aw(param));
|
||||
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
if (!_tcsncmp(param, _T("/?"), 2))
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_GOTO_HELP1);
|
||||
ConOutResPaging(TRUE, STRING_GOTO_HELP1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if not in batch -- error!! */
|
||||
/* If not in batch, fail */
|
||||
if (bc == NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Fail if no label has been provided */
|
||||
if (*param == _T('\0'))
|
||||
{
|
||||
ConErrResPrintf(STRING_GOTO_ERROR1);
|
||||
|
@ -61,11 +57,11 @@ INT cmd_goto (LPTSTR param)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* terminate label at first space char */
|
||||
tmp = param+1;
|
||||
while (!_istcntrl (*tmp) && !_istspace (*tmp) && (*tmp != _T(':')))
|
||||
tmp++;
|
||||
*(tmp) = _T('\0');
|
||||
/* Terminate label at first space char */
|
||||
tmp = param + 1;
|
||||
while (!_istcntrl(*tmp) && !_istspace(*tmp) && (*tmp != _T(':')))
|
||||
++tmp;
|
||||
*tmp = _T('\0');
|
||||
|
||||
/* jump to end of the file */
|
||||
if ( _tcsicmp( param, _T(":eof"))==0)
|
||||
|
@ -77,38 +73,36 @@ INT cmd_goto (LPTSTR param)
|
|||
/* jump to begin of the file */
|
||||
bc->mempos=0;
|
||||
|
||||
while (BatchGetString (textline, sizeof(textline) / sizeof(textline[0])))
|
||||
while (BatchGetString(textline, ARRAYSIZE(textline)))
|
||||
{
|
||||
int pos;
|
||||
INT pos;
|
||||
INT_PTR size;
|
||||
|
||||
/* Strip out any trailing spaces or control chars */
|
||||
tmp = textline + _tcslen (textline) - 1;
|
||||
|
||||
while (tmp > textline && (_istcntrl (*tmp) || _istspace (*tmp) || (*tmp == _T(':'))))
|
||||
tmp--;
|
||||
tmp = textline + _tcslen(textline) - 1;
|
||||
while (tmp > textline && (_istcntrl(*tmp) || _istspace(*tmp) || (*tmp == _T(':'))))
|
||||
--tmp;
|
||||
*(tmp + 1) = _T('\0');
|
||||
|
||||
/* Then leading spaces... */
|
||||
tmp = textline;
|
||||
while (_istspace (*tmp))
|
||||
tmp++;
|
||||
while (_istspace(*tmp))
|
||||
++tmp;
|
||||
|
||||
/* All space after leading space terminate the string */
|
||||
size = _tcslen(tmp) -1;
|
||||
pos=0;
|
||||
while (tmp+pos < tmp+size)
|
||||
size = _tcslen(tmp) - 1;
|
||||
pos = 0;
|
||||
while (tmp + pos < tmp + size)
|
||||
{
|
||||
if (_istspace(tmp[pos]))
|
||||
tmp[pos]=_T('\0');
|
||||
pos++;
|
||||
++pos;
|
||||
}
|
||||
|
||||
tmp2 = param;
|
||||
/* use whole label name */
|
||||
if ((*tmp == _T(':')) && ((_tcsicmp (++tmp, param) == 0) || (_tcsicmp (tmp, ++tmp2) == 0)))
|
||||
/* Use whole label name */
|
||||
if ((*tmp == _T(':')) && ((_tcsicmp(++tmp, param) == 0) || (_tcsicmp(tmp, ++tmp2) == 0)))
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
ConErrResPrintf(STRING_GOTO_ERROR2, param);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue