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/msg.c
static rsRetVal aquirePROCIDFromTAG(smsg_t* const pM)
    {
        register int i;
        uchar* pszTag;
        DEFiRet;

        assert(pM != NULL);

        if (pM->pCSPROCID != NULL)
            return RS_RET_OK; /* we are already done ;) */

        if (msgGetProtocolVersion(pM) != 0)
            return RS_RET_OK; /* we can only emulate if we have legacy format */

        pszTag = (uchar*)((pM->iLenTAG < CONF_TAG_BUFSIZE) ? pM->TAG.szBuf
                                                           : pM->TAG.pszTAG);

        /* find first '['... */
        i = 0;
        while ((i < pM->iLenTAG) && (pszTag[i] != '['))
            ++i;
        if (!(i < pM->iLenTAG))
            return RS_RET_OK; /* no [, so can not emulate... */

        ++i; /* skip '[' */

        /* now obtain the PROCID string... */
        CHKiRet(cstrConstruct(&pM->pCSPROCID));
        while ((i < pM->iLenTAG) && (pszTag[i] != ']'))
        {
            CHKiRet(cstrAppendChar(pM->pCSPROCID, pszTag[i]));
            ++i;
        }

        if (!(i < pM->iLenTAG))
        {
            /* oops... it looked like we had a PROCID, but now it has
             * turned out this is not true. In this case, we need to free
             * the buffer and simply return. Note that this is NOT an error
             * case!
             */
            cstrDestruct(&pM->pCSPROCID);
            FINALIZE;
        }

        /* OK, finally we could obtain a PROCID. So let's use it ;) */
        cstrFinalize(pM->pCSPROCID);

    finalize_it:
        RETiRet;
    }
/* This functions tries to aquire the PROCID from TAG. Its primary use is
     * when a legacy syslog message has been received and should be forwarded as
     * syslog-protocol (or the PROCID is requested for any other reason).
     * In legacy syslog, the PROCID is considered to be the character sequence
     * between the first [ and the first ]. This usually are digits only, but we
     * do not check that. However, if there is no closing ], we do not assume we
     * can obtain a PROCID. Take in mind that not every legacy syslog message
     * actually has a PROCID.
     * rgerhards, 2005-11-24
     * THIS MUST be called with the message lock locked.
     */
This functions tries to aquire the PROCID from TAG. Its primary use is
when a legacy syslog message has been received and should be forwarded as
syslog-protocol (or the PROCID is requested for any other reason).
In legacy syslog, the PROCID is considered to be the character sequence
between the first [ and the first ]. This usually are digits only, but we
do not check that. However, if there is no closing ], we do not assume we
can obtain a PROCID. Take in mind that not every legacy syslog message
actually has a PROCID.
rgerhards, 2005-11-24
THIS MUST be called with the message lock locked.
This functions tries to aquire the PROCID from TAG . Its primary use is when a legacy syslog message has been received and should be forwarded as syslog - protocol ( or the PROCID is requested for any other reason ) . In legacy syslog the PROCID is considered to be the character sequence between the first [ and the first ] . This usually are digits only but we do not check that . However if there is no closing ] we do not assume we can obtain a PROCID . Take in mind that not every legacy syslog message actually has a PROCID . rgerhards 2005 - 11 - 24 THIS MUST be called with the message lock locked .
static rsRetVal aquirePROCIDFromTAG(smsg_t* const pM)
    {
        register int i;
        uchar* pszTag;
        DEFiRet;
        assert(pM != NULL);
        if (pM->pCSPROCID != NULL)
            return RS_RET_OK; 
        if (msgGetProtocolVersion(pM) != 0)
            return RS_RET_OK; 
        pszTag = (uchar*)((pM->iLenTAG < CONF_TAG_BUFSIZE) ? pM->TAG.szBuf
                                                           : pM->TAG.pszTAG);
        i = 0;
        while ((i < pM->iLenTAG) && (pszTag[i] != '['))
            ++i;
        if (!(i < pM->iLenTAG))
            return RS_RET_OK; 
        ++i; 
        CHKiRet(cstrConstruct(&pM->pCSPROCID));
        while ((i < pM->iLenTAG) && (pszTag[i] != ']'))
        {
            CHKiRet(cstrAppendChar(pM->pCSPROCID, pszTag[i]));
            ++i;
        }
        if (!(i < pM->iLenTAG))
        {
            cstrDestruct(&pM->pCSPROCID);
            FINALIZE;
        }
        cstrFinalize(pM->pCSPROCID);
    finalize_it:
        RETiRet;
    }
static rsRetVal aquirePROCIDFromTAG ( smsg_t * const pM ) { register int i ; uchar * pszTag ; DEFiRet ; assert ( pM != NULL ) ; if ( pM -> pCSPROCID != NULL ) return RS_RET_OK ; if ( msgGetProtocolVersion ( pM ) != 0 ) return RS_RET_OK ; pszTag = ( uchar * ) ( ( pM -> iLenTAG < CONF_TAG_BUFSIZE ) ? pM -> TAG . szBuf : pM -> TAG . pszTAG ) ; i = 0 ; while ( ( i < pM -> iLenTAG ) && ( pszTag [ i ] != ' ' ) ) ++ i ; if ( ! ( i < pM -> iLenTAG ) ) return RS_RET_OK ; ++ i ; CHKiRet ( cstrConstruct ( & pM -> pCSPROCID ) ) ; while ( ( i < pM -> iLenTAG ) && ( pszTag [ i ] != ' ' ) ) { CHKiRet ( cstrAppendChar ( pM -> pCSPROCID , pszTag [ i ] ) ) ; ++ i ; } if ( ! ( i < pM -> iLenTAG ) ) { cstrDestruct ( & pM -> pCSPROCID ) ; FINALIZE ; } cstrFinalize ( pM -> pCSPROCID ) ; finalize_it : RETiRet ; }
This functions tries to aquire the PROCID from TAG.
This functions tries to aquire the PROCID from TAG .
/* we are already done ;) */ /* we can only emulate if we have legacy format */ /* find first '['... */ /* no [, so can not emulate... */ /* skip '[' */ /* now obtain the PROCID string... */ /* oops... it looked like we had a PROCID, but now it has
             * turned out this is not true. In this case, we need to free
             * the buffer and simply return. Note that this is NOT an error
             * case!
             */ /* OK, finally we could obtain a PROCID. So let's use it ;) */