Ejemplo n.º 1
0
void print_oneprio(FILE *output, void * statetree, void * hoptree, void * rbcolumns, int prio)
{
	xtreePos_t hhandle;
	static int firsthostever = 1;
	int firsthostthisprio = 1;
	char *curhost = "";

	/* Then output each host and their column status */
	for (hhandle = xtreeFirst(statetree); (hhandle != xtreeEnd(statetree)); hhandle = xtreeNext(statetree, hhandle)) {
		hstatus_t *itm;

		itm = (hstatus_t *)xtreeData(statetree, hhandle);

		if (itm->config->priority != prio) continue;
		if (strcmp(curhost, itm->hostname) == 0) continue;

		/* New host */
		curhost = itm->hostname;
		print_hoststatus(output, itm, statetree, rbcolumns, prio, firsthostthisprio, firsthostever);
		xtreeAdd(hoptree, itm->hostname, itm);
		firsthostthisprio = 0;
	}

	/* If we did output any hosts, make some room for the next priority */
	if (!firsthostthisprio) fprintf(output, "<TR><TD>&nbsp;</TD></TR>\n");
}
Ejemplo n.º 2
0
void print_oneprio(FILE *output, RbtHandle rbstate, RbtHandle rbcolumns, int prio)
{
	RbtIterator hhandle;
	int firsthost = 1;
	char *curhost = "";

	/* Then output each host and their column status */
	for (hhandle = rbtBegin(rbstate); (hhandle != rbtEnd(rbstate)); hhandle = rbtNext(rbstate, hhandle)) {
		void *k1, *k2;
		hstatus_t *itm;

	        rbtKeyValue(rbstate, hhandle, &k1, &k2);
		itm = (hstatus_t *)k2;

		if (itm->config->priority != prio) continue;
		if (strcmp(curhost, itm->hostname) == 0) continue;

		/* New host */
		curhost = itm->hostname;
		print_hoststatus(output, itm, rbcolumns, prio, firsthost);
		firsthost = 0;
	}

	/* If we did output any hosts, make some room for the next priority */
	if (!firsthost) fprintf(output, "<TR><TD>&nbsp;</TD></TR>\n");
}