Пример #1
0
void EndAudit(int background_tasks)
{
    if (!END_AUDIT_REQUIRED)
    {
        return;
    }

    char *sp, string[CF_BUFSIZE];
    Rval retval;
    Promise dummyp = { 0 };
    Attributes dummyattr = { {0} };

    memset(&dummyp, 0, sizeof(dummyp));
    memset(&dummyattr, 0, sizeof(dummyattr));

    if (BooleanControl("control_agent", CFA_CONTROLBODY[cfa_track_value].lval))
    {
        FILE *fout;
        char name[CF_MAXVARSIZE], datestr[CF_MAXVARSIZE];
        time_t now = time(NULL);

        CfOut(cf_inform, "", " -> Recording promise valuations");

        snprintf(name, CF_MAXVARSIZE, "%s/state/%s", CFWORKDIR, CF_VALUE_LOG);
        snprintf(datestr, CF_MAXVARSIZE, "%s", cf_ctime(&now));

        if ((fout = fopen(name, "a")) == NULL)
        {
            CfOut(cf_inform, "", " !! Unable to write to the value log %s\n", name);
            return;
        }

        if (Chop(datestr, CF_EXPANDSIZE) == -1)
        {
            CfOut(cf_error, "", "Chop was called on a string that seemed to have no terminator");
        }
        fprintf(fout, "%s,%.4lf,%.4lf,%.4lf\n", datestr, VAL_KEPT, VAL_REPAIRED, VAL_NOTKEPT);
        TrackValue(datestr, VAL_KEPT, VAL_REPAIRED, VAL_NOTKEPT);
        fclose(fout);
    }

    double total = (double) (PR_KEPT + PR_NOTKEPT + PR_REPAIRED) / 100.0;

    if (GetVariable("control_common", "version", &retval) != DATA_TYPE_NONE)
    {
        sp = (char *) retval.item;
    }
    else
    {
        sp = "(not specified)";
    }

    if (total == 0)
    {
        *string = '\0';
        CfOut(cf_verbose, "", "Outcome of version %s: No checks were scheduled\n", sp);
        return;
    }
    else
    {
        LogTotalCompliance(sp, background_tasks);
    }
}
Пример #2
0
void EndAudit(const EvalContext *ctx, int background_tasks)
{
    if (!END_AUDIT_REQUIRED)
    {
        return;
    }

    char *sp, string[CF_BUFSIZE];
    Rval retval = { 0 };
    Promise dummyp = { 0 };
    Attributes dummyattr = { {0} };

    memset(&dummyp, 0, sizeof(dummyp));
    memset(&dummyattr, 0, sizeof(dummyattr));

    {
        Rval track_value_rval = { 0 };
        bool track_value = false;
        if (EvalContextVariableGet(ctx, (VarRef) { NULL, "control_agent", CFA_CONTROLBODY[AGENT_CONTROL_TRACK_VALUE].lval }, &track_value_rval, NULL))
        {
            track_value = BooleanFromString(track_value_rval.item);
        }

        if (track_value)
        {
            FILE *fout;
            char name[CF_MAXVARSIZE], datestr[CF_MAXVARSIZE];
            time_t now = time(NULL);

            CfOut(OUTPUT_LEVEL_INFORM, "", " -> Recording promise valuations");

            snprintf(name, CF_MAXVARSIZE, "%s/state/%s", CFWORKDIR, CF_VALUE_LOG);
            snprintf(datestr, CF_MAXVARSIZE, "%s", cf_ctime(&now));

            if ((fout = fopen(name, "a")) == NULL)
            {
                CfOut(OUTPUT_LEVEL_INFORM, "", " !! Unable to write to the value log %s\n", name);
                return;
            }

            if (Chop(datestr, CF_EXPANDSIZE) == -1)
            {
                CfOut(OUTPUT_LEVEL_ERROR, "", "Chop was called on a string that seemed to have no terminator");
            }
            fprintf(fout, "%s,%.4lf,%.4lf,%.4lf\n", datestr, VAL_KEPT, VAL_REPAIRED, VAL_NOTKEPT);
            TrackValue(datestr, VAL_KEPT, VAL_REPAIRED, VAL_NOTKEPT);
            fclose(fout);
        }
    }

    double total = (double) (PR_KEPT + PR_NOTKEPT + PR_REPAIRED) / 100.0;

    if (ScopeControlCommonGet(ctx, COMMON_CONTROL_VERSION, &retval) != DATA_TYPE_NONE)
    {
        sp = (char *) retval.item;
    }
    else
    {
        sp = "(not specified)";
    }

    if (total == 0)
    {
        *string = '\0';
        CfOut(OUTPUT_LEVEL_VERBOSE, "", "Outcome of version %s: No checks were scheduled\n", sp);
        return;
    }
    else
    {
        LogTotalCompliance(sp, background_tasks);
    }
}
Пример #3
0
LRESULT CMainDlg::OnVScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	int id = HIWORD(wParam);
	int code = LOWORD(wParam);
	if (code == TB_ENDTRACK || code == TB_THUMBTRACK)
	{
		HWND w = (HWND) lParam;
		if (w == gen1Frq)
			TrackValue(gen1Frq, gen1FrqEd, 1.0, 120);
		else if (w == gen1Vol)
			TrackValue(gen1Vol, gen1VolEd, 100.0, 100);
		else if (w == gen1Atk)
			TrackValue(gen1Atk, gen1AtkEd, 1000.0);
		else if (w == gen1Dec)
			TrackValue(gen1Dec, gen1DecEd, 1000.0);
		else if (w == gen1Sus)
			TrackValue(gen1Sus, gen1SusEd, 100.0, 100);
		else if (w == gen1Rel)
			TrackValue(gen1Rel, gen1RelEd, 1000.0);

		else if (w == gen2Mul)
			TrackValue(gen2Mul, gen2MulEd, 10.0);
		else if (w == gen2Ndx)
			TrackValue(gen2Ndx, gen2NdxEd, 10.0, 500);
		else if (w == gen2Atk)
			TrackValue(gen2Atk, gen2AtkEd, 1000.0);
		else if (w == gen2Pck)
			TrackValue(gen2Pck, gen2PckEd, 10.0, 500);
		else if (w == gen2Dec)
			TrackValue(gen2Dec, gen2DecEd, 1000.0);
		else if (w == gen2Sus)
			TrackValue(gen2Sus, gen2SusEd, 10.0, 500);
		else if (w == gen2Rel)
			TrackValue(gen2Rel, gen2RelEd, 1000.0);
		else if (w == gen2End)
			TrackValue(gen2End, gen2EndEd, 10.0, 500);

		else if (w == gen3Mul)
			TrackValue(gen3Mul, gen3MulEd, 10.0);
		else if (w == gen3Ndx)
			TrackValue(gen3Ndx, gen3NdxEd, 10.0, 500);
		else if (w == gen3Atk)
			TrackValue(gen3Atk, gen3AtkEd, 1000.0);
		else if (w == gen3Pck)
			TrackValue(gen3Pck, gen3PckEd, 10.0, 500);
		else if (w == gen3Dec)
			TrackValue(gen3Dec, gen3DecEd, 1000.0);
		else if (w == gen3Sus)
			TrackValue(gen3Sus, gen3SusEd, 10.0, 500);
		else if (w == gen3Rel)
			TrackValue(gen3Rel, gen3RelEd, 1000.0);
		else if (w == gen3End)
			TrackValue(gen3End, gen3EndEd, 10.0, 500);
	}
	return 0;
}