Optimize CGI generation code a bit.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5736 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2009-06-09 12:44:44 +00:00
1 parent a5bb03f300
commit 8eeb9081a8
2 files changed
+6 -13

No files matched your search

+4 -13
View File
@@ -404,15 +404,6 @@ static struct gr graphs[] = {
"HOUR:6:DAY:1:DAY:1:86400:%a %b %d",
"-s -1w --alt-autoscale",
0
}, {
DataType_other,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0
}
};
@@ -456,11 +447,12 @@ int rrdUpdate(void)
int rrdCGI(void)
{
int ret = 0;
struct gr *graph = graphs;
int ret = 0, i;
printf("#!" RRDCGI "\n\n<HTML>\n<HEAD>\n<TITLE>sensord</TITLE>\n</HEAD>\n<BODY>\n<H1>sensord</H1>\n");
while (graph->type != DataType_other) {
for (i = 0; i < ARRAY_SIZE(graphs); i++) {
struct gr *graph = &graphs[i];
printf("<H2>%s</H2>\n", graph->h2);
printf("<P>\n<RRD::GRAPH %s/%s.png\n\t--imginfo '<IMG SRC=" WWWDIR "/%%s WIDTH=%%lu HEIGHT=%%lu>'\n\t-a PNG\n\t-h 200 -w 800\n",
sensord_args.cgiDir, graph->image);
@@ -476,7 +468,6 @@ int rrdCGI(void)
if (!ret && sensord_args.doLoad && graph->loadAvg)
ret = rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL);
printf (">\n</P>\n");
++ graph;
}
printf("<p>\n<small><b>sensord</b> by <a href=\"mailto:merlin@merlin.org\">Merlin Hughes</a>, all credit to the <a href=\"http://www.lm-sensors.org/\">lm_sensors</a> crew.</small>\n</p>\n");
printf("</BODY>\n</HTML>\n");
+2
View File
@@ -23,6 +23,8 @@
#include "lib/sensors.h"
#define ARRAY_SIZE(arr) (int)(sizeof(arr) / sizeof((arr)[0]))
extern void sensorLog(int priority, const char *fmt, ...);
/* from args.c */