ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

INT cmd_goto ( LPTSTR  param)

Definition at line 39 of file goto.c.

Referenced by Batch().

{
    LPTSTR tmp, tmp2;

    TRACE ("cmd_goto (\'%s\')\n", debugstr_aw(param));

    if (!_tcsncmp (param, _T("/?"), 2))
    {
        ConOutResPaging(TRUE,STRING_GOTO_HELP1);
        return 0;
    }

    /* if not in batch -- error!! */
    if (bc == NULL)
    {
        return 1;
    }

    if (*param == _T('\0'))
    {
        ConErrResPrintf(STRING_GOTO_ERROR1);
        ExitBatch();
        return 1;
    }

    /* 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)
    {
        bc->mempos=bc->memsize;     /* position at the end of the batchfile */
        return 0;
    }

    /* jump to begin of the file */
    bc->mempos=0;

    while (BatchGetString (textline, sizeof(textline) / sizeof(textline[0])))
    {
        int pos;
        INT_PTR size;

        /* Strip out any trailing spaces or control chars */
        tmp = textline + _tcslen (textline) - 1;

        while (_istcntrl (*tmp) || _istspace (*tmp) ||  (*tmp == _T(':')))
            tmp--;
        *(tmp + 1) = _T('\0');

        /* Then leading spaces... */
        tmp = textline;
        while (_istspace (*tmp))
            tmp++;

        /* All space after leading space terminate the string */
        size = _tcslen(tmp) -1;
        pos=0;
        while (tmp+pos < tmp+size)
        {
            if (_istspace(tmp[pos]))
                tmp[pos]=_T('\0');
            pos++;
        }

        tmp2 = param;
        /* use whole label name */
        if ((*tmp == _T(':')) && ((_tcsicmp (++tmp, param) == 0) || (_tcsicmp (tmp, ++tmp2) == 0)))
            return 0;

    }

    ConErrResPrintf(STRING_GOTO_ERROR2, param);
    ExitBatch();
    return 1;
}

Generated on Fri May 25 2012 04:44:28 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.