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/tools/omfile.c
static rsRetVal cflineParseOutchannel(instanceData* pData, uchar* p,
                                      omodStringRequest_t* pOMSR, int iEntry,
                                      int iTplOpts)
{
    DEFiRet;
    size_t i;
    struct outchannel* pOch;
    char szBuf[128]; /* should be more than sufficient */

    ++p; /* skip '$' */
    i = 0;
    /* get outchannel name */
    while (*p && *p != ';' && *p != ' ' && i < (sizeof(szBuf) - 1))
    {
        szBuf[i++] = *p++;
    }
    szBuf[i] = '\0';

    /* got the name, now look up the channel... */
    pOch = ochFind(szBuf, i);

    if (pOch == NULL)
    {
        parser_errmsg("outchannel '%s' not found - ignoring action line",
                      szBuf);
        ABORT_FINALIZE(RS_RET_NOT_FOUND);
    }

    /* check if there is a file name in the outchannel... */
    if (pOch->pszFileTemplate == NULL)
    {
        parser_errmsg(
            "outchannel '%s' has no file name template - ignoring action line",
            szBuf);
        ABORT_FINALIZE(RS_RET_ERR);
    }

    /* OK, we finally got a correct template. So let's use it... */
    pData->fname = ustrdup(pOch->pszFileTemplate);
    pData->iSizeLimit = pOch->uSizeLimit;
    /* WARNING: It is dangerous "just" to pass the pointer. As we
     * never rebuild the output channel description, this is acceptable here.
     */
    pData->pszSizeLimitCmd = pOch->cmdOnSizeLimit;

    iRet = cflineParseTemplateName(&p, pOMSR, iEntry, iTplOpts, getDfltTpl());

finalize_it:
    RETiRet;
}
/* Helper to cfline(). Parses a output channel name up until the first
 * comma and then looks for the template specifier. Tries
 * to find that template. Maps the output channel to the
 * proper filed structure settings. Everything is stored in the
 * filed struct. Over time, the dependency on filed might be
 * removed.
 * rgerhards 2005-06-21
 */
Helper to cfline(). Parses a output channel name up until the first
comma and then looks for the template specifier. Tries
to find that template. Maps the output channel to the
proper filed structure settings. Everything is stored in the
filed struct. Over time, the dependency on filed might be
removed.
Helper to cfline () . Parses a output channel name up until the first comma and then looks for the template specifier . Tries to find that template . Maps the output channel to the proper filed structure settings . Everything is stored in the filed struct . Over time the dependency on filed might be removed .
static rsRetVal cflineParseOutchannel(instanceData* pData, uchar* p,
                                      omodStringRequest_t* pOMSR, int iEntry,
                                      int iTplOpts)
{
    DEFiRet;
    size_t i;
    struct outchannel* pOch;
    char szBuf[128]; 
    ++p; 
    i = 0;
    while (*p && *p != ';' && *p != ' ' && i < (sizeof(szBuf) - 1))
    {
        szBuf[i++] = *p++;
    }
    szBuf[i] = '\0';
    pOch = ochFind(szBuf, i);
    if (pOch == NULL)
    {
        parser_errmsg("outchannel '%s' not found - ignoring action line",
                      szBuf);
        ABORT_FINALIZE(RS_RET_NOT_FOUND);
    }
    if (pOch->pszFileTemplate == NULL)
    {
        parser_errmsg(
            "outchannel '%s' has no file name template - ignoring action line",
            szBuf);
        ABORT_FINALIZE(RS_RET_ERR);
    }
    pData->fname = ustrdup(pOch->pszFileTemplate);
    pData->iSizeLimit = pOch->uSizeLimit;
    pData->pszSizeLimitCmd = pOch->cmdOnSizeLimit;
    iRet = cflineParseTemplateName(&p, pOMSR, iEntry, iTplOpts, getDfltTpl());
finalize_it:
    RETiRet;
}
static rsRetVal cflineParseOutchannel ( instanceData * pData , uchar * p , omodStringRequest_t * pOMSR , int iEntry , int iTplOpts ) { DEFiRet ; size_t i ; struct outchannel * pOch ; char szBuf [ 128 ] ; ++ p ; i = 0 ; while ( * p && * p != ' ' && * p != ' ' && i < ( sizeof ( szBuf ) - 1 ) ) { szBuf [ i ++ ] = * p ++ ; } szBuf [ i ] = ' \0 ' ; pOch = ochFind ( szBuf , i ) ; if ( pOch == NULL ) { parser_errmsg ( " " , szBuf ) ; ABORT_FINALIZE ( RS_RET_NOT_FOUND ) ; } if ( pOch -> pszFileTemplate == NULL ) { parser_errmsg ( " " , szBuf ) ; ABORT_FINALIZE ( RS_RET_ERR ) ; } pData -> fname = ustrdup ( pOch -> pszFileTemplate ) ; pData -> iSizeLimit = pOch -> uSizeLimit ; pData -> pszSizeLimitCmd = pOch -> cmdOnSizeLimit ; iRet = cflineParseTemplateName ( & p , pOMSR , iEntry , iTplOpts , getDfltTpl ( ) ) ; finalize_it : RETiRet ; }
Helper to cfline().
Helper to cfline () .
/* should be more than sufficient */ /* skip '$' */ /* get outchannel name */ /* got the name, now look up the channel... */ /* check if there is a file name in the outchannel... */ /* OK, we finally got a correct template. So let's use it... */ /* WARNING: It is dangerous "just" to pass the pointer. As we
     * never rebuild the output channel description, this is acceptable here.
     */