Exemple #1
0
/**
 * \fn msiGetStderrInExecCmdOut (msParam_t *inpExecCmdOut, msParam_t *outStr, ruleExecInfo_t *rei)
 *
 * \brief Gets stderr buffer from ExecCmdOut into buffer.
 *
 * \module core
 *
 * \since pre-2.1
 *
 * \author Mike Wan
 *
 * \usage See clients/icommands/test/rules/
 *
 * \param[in] inpExecCmdOut - a STR_MS_T which specifies the ExecCmdOut.
 * \param[out] outStr - a STR_MS_T to hold the retrieved stderr buffer.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 upon success
 * \pre none
 * \post none
 * \sa none
**/
int
msiGetStderrInExecCmdOut( msParam_t *inpExecCmdOut, msParam_t *outStr,
                          ruleExecInfo_t *rei ) {
    char *strPtr = NULL;

    rei->status = getStderrInExecCmdOut( inpExecCmdOut, &strPtr );

    if ( rei->status < 0 ) {
        if ( rei->status != SYS_INTERNAL_NULL_INPUT_ERR ) {
            return rei->status;
        }
        else {
            free( strPtr );
            strPtr = NULL;
            rei->status = 0;
        }
    }

    if ( strPtr != NULL ) {
        fillStrInMsParam( outStr, strPtr );
        free( strPtr );
    }
    else {
        fillStrInMsParam( outStr, "" );
    }

    return rei->status;
}
Exemple #2
0
/**
 * \fn msiGetStderrInExecCmdOut (msParam_t *inpExecCmdOut, msParam_t *outStr, ruleExecInfo_t *rei)
 *
 * \brief Gets stderr buffer from ExecCmdOut into buffer.
 *
 * \module core
 *
 * \since pre-2.1
 *
 * \author Mike Wan 
 * \date 2009   
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] inpExecCmdOut - a STR_MS_T which specifies the ExecCmdOut.
 * \param[out] outStr - a STR_MS_T to hold the retrieved stderr buffer.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 upon success
 * \pre none
 * \post none
 * \sa none
**/
int
msiGetStderrInExecCmdOut (msParam_t *inpExecCmdOut, msParam_t *outStr,
ruleExecInfo_t *rei)
{
    char *strPtr = NULL;

    rei->status = getStderrInExecCmdOut (inpExecCmdOut, &strPtr);

    if (rei->status < 0) {
      if (rei->status != SYS_INTERNAL_NULL_INPUT_ERR)
	return rei->status; 
      else {
	strPtr = "";
	rei->status = 0;
      }
    }

    if (strPtr == NULL)
      strPtr="";
    fillStrInMsParam (outStr, strPtr);

    return rei->status;
}