openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/conf.c
rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t* pOMSR,
                                 int iEntry, int iTplOpts, uchar* dfltTplName)
{
    uchar* p;
    uchar* tplName = NULL;
    cstr_t* pStrB = NULL;
    DEFiRet;

    assert(pp != NULL);
    assert(*pp != NULL);
    assert(pOMSR != NULL);

    p = *pp;
    /* a template must follow - search it and complain, if not found */
    skipWhiteSpace(&p);
    if (*p == ';')
        ++p; /* eat it */
    else if (*p != '\0' && *p != '#')
    {
        LogError(0, RS_RET_ERR,
                 "invalid character in selector line - ';template' expected");
        ABORT_FINALIZE(RS_RET_ERR);
    }

    skipWhiteSpace(&p); /* go to begin of template name */

    if (*p == '\0' || *p == '#')
    {
        /* no template specified, use the default */
        /* TODO: check NULL ptr */
        tplName = (uchar*)strdup((char*)dfltTplName);
    }
    else
    {
        /* template specified, pick it up */
        CHKiRet(cstrConstruct(&pStrB));

        /* now copy the string */
        while (*p && *p != '#' && !isspace((int)*p))
        {
            CHKiRet(cstrAppendChar(pStrB, *p));
            ++p;
        }
        cstrFinalize(pStrB);
        CHKiRet(cstrConvSzStrAndDestruct(&pStrB, &tplName, 0));
    }

    CHKiRet(OMSRsetEntry(pOMSR, iEntry, tplName, iTplOpts));

finalize_it:
    if (iRet != RS_RET_OK)
    {
        free(tplName);
        if (pStrB != NULL)
            cstrDestruct(&pStrB);
    }

    *pp = p;

    RETiRet;
}
/* Helper to cfline() and its helpers. Parses a template name
 * from an "action" line. Must be called with the Line pointer
 * pointing to the first character after the semicolon.
 * rgerhards 2004-11-19
 * changed function to work with OMSR. -- rgerhards, 2007-07-27
 * the default template is to be used when no template is specified.
 */
Helper to cfline() and its helpers. Parses a template name
from an "action" line. Must be called with the Line pointer
pointing to the first character after the semicolon.
rgerhards 2004-11-19
changed function to work with OMSR. -- rgerhards, 2007-07-27
the default template is to be used when no template is specified.
Helper to cfline () and its helpers . Parses a template name from an " action " line . Must be called with the Line pointer pointing to the first character after the semicolon . rgerhards 2004 - 11 - 19 changed function to work with OMSR . -- rgerhards 2007 - 07 - 27 the default template is to be used when no template is specified .
rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t* pOMSR,
                                 int iEntry, int iTplOpts, uchar* dfltTplName)
{
    uchar* p;
    uchar* tplName = NULL;
    cstr_t* pStrB = NULL;
    DEFiRet;
    assert(pp != NULL);
    assert(*pp != NULL);
    assert(pOMSR != NULL);
    p = *pp;
    skipWhiteSpace(&p);
    if (*p == ';')
        ++p; 
    else if (*p != '\0' && *p != '#')
    {
        LogError(0, RS_RET_ERR,
                 "invalid character in selector line - ';template' expected");
        ABORT_FINALIZE(RS_RET_ERR);
    }
    skipWhiteSpace(&p); 
    if (*p == '\0' || *p == '#')
    {
        tplName = (uchar*)strdup((char*)dfltTplName);
    }
    else
    {
        CHKiRet(cstrConstruct(&pStrB));
        while (*p && *p != '#' && !isspace((int)*p))
        {
            CHKiRet(cstrAppendChar(pStrB, *p));
            ++p;
        }
        cstrFinalize(pStrB);
        CHKiRet(cstrConvSzStrAndDestruct(&pStrB, &tplName, 0));
    }
    CHKiRet(OMSRsetEntry(pOMSR, iEntry, tplName, iTplOpts));
finalize_it:
    if (iRet != RS_RET_OK)
    {
        free(tplName);
        if (pStrB != NULL)
            cstrDestruct(&pStrB);
    }
    *pp = p;
    RETiRet;
}
rsRetVal cflineParseTemplateName ( uchar * * pp , omodStringRequest_t * pOMSR , int iEntry , int iTplOpts , uchar * dfltTplName ) { uchar * p ; uchar * tplName = NULL ; cstr_t * pStrB = NULL ; DEFiRet ; assert ( pp != NULL ) ; assert ( * pp != NULL ) ; assert ( pOMSR != NULL ) ; p = * pp ; skipWhiteSpace ( & p ) ; if ( * p == ' ' ) ++ p ; else if ( * p != ' \0 ' && * p != ' ' ) { LogError ( 0 , RS_RET_ERR , " " ) ; ABORT_FINALIZE ( RS_RET_ERR ) ; } skipWhiteSpace ( & p ) ; if ( * p == ' \0 ' || * p == ' ' ) { tplName = ( uchar * ) strdup ( ( char * ) dfltTplName ) ; } else { CHKiRet ( cstrConstruct ( & pStrB ) ) ; while ( * p && * p != ' ' && ! isspace ( ( int ) * p ) ) { CHKiRet ( cstrAppendChar ( pStrB , * p ) ) ; ++ p ; } cstrFinalize ( pStrB ) ; CHKiRet ( cstrConvSzStrAndDestruct ( & pStrB , & tplName , 0 ) ) ; } CHKiRet ( OMSRsetEntry ( pOMSR , iEntry , tplName , iTplOpts ) ) ; finalize_it : if ( iRet != RS_RET_OK ) { free ( tplName ) ; if ( pStrB != NULL ) cstrDestruct ( & pStrB ) ; } * pp = p ; RETiRet ; }
Helper to cfline() and its helpers.
Helper to cfline () and its helpers .
/* a template must follow - search it and complain, if not found */ /* eat it */ /* go to begin of template name */ /* no template specified, use the default */ /* TODO: check NULL ptr */ /* template specified, pick it up */ /* now copy the string */