Skip to contentSkip to conversation

sensord: Convert CGI script to lower case

PATCH Superseded Andre Prendel 2 participants 3 messages Jun 15, 2009 – Jun 23, 2009

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 sensord: Convert CGI script to lower case

This patch converts HTML code in the generated CGI script to lower case. This makes us a bit more XHTML compatible.
---

 rrd.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: sensors/prog/sensord/rrd.c
=================================--- sensors.orig/prog/sensord/rrd.c 2009-06-09 20:31:13.000000000 +0200
+++ sensors/prog/sensord/rrd.c 2009-06-09 22:05:04.000000000 +0200
@@ -449,16 +449,16 @@
{
int ret = 0, i;

- printf("#!" RRDCGI "\n\n<HTML>\n"
- "<HEAD>\n<TITLE>sensord</TITLE>\n</HEAD>\n"
- "<BODY>\n<H1>sensord</H1>\n");
+ printf("#!" RRDCGI "\n\n<html>\n"
+ "<head>\n<title>sensord</title>\n</head>\n"
+ "<body>\n<h1>sensord</h1>\n");

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>'"
+ 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);

@@ -473,7 +473,7 @@
ret = applyToFeatures(rrdCGI_LINE, graph);
if (!ret && sensord_args.doLoad && graph->loadAvg)
ret = rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL);
- printf (">\n</P>\n");
+ printf (">\n</p>\n");
}
printf("<p>\n<small><b>sensord</b> by "
"<a href=\"mailto:[email protected]\">Merlin Hughes</a>"
@@ -481,7 +481,7 @@
"<a href=\"http://www.lm-sensors.org/\">lm_sensors</a> " "crew.</small>\n</p>\n");

- printf("</BODY>\n</HTML>\n");
+ printf("</body>\n</html>\n");

return ret;
}

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

Re: [lm-sensors] [PATCH 2/5] sensord: Convert CGI script to lower

Quoted 20 lines · Andre Prendel

This patch converts HTML code in the generated CGI script to lower case. This makes us a bit more XHTML compatible.
---

 rrd.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: sensors/prog/sensord/rrd.c
=================================> --- sensors.orig/prog/sensord/rrd.c 2009-06-09 20:31:13.000000000 +0200
+++ sensors/prog/sensord/rrd.c 2009-06-09 22:05:04.000000000 +0200

(quoted diff) +3 -3
@@ -449,16 +449,16 @@
 {
 	int ret = 0, i;
 
-	printf("#!" RRDCGI "\n\n<HTML>\n"
-	       "<HEAD>\n<TITLE>sensord</TITLE>\n</HEAD>\n"
-	       "<BODY>\n<H1>sensord</H1>\n");
+	printf("#!" RRDCGI "\n\n<html>\n"
+	       "<head>\n<title>sensord</title>\n</head>\n"
+	       "<body>\n<h1>sensord</h1>\n");

Review line 461

Quoted 10 lines
(quoted diff) +3 -3
 
 	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>'"
+		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>'"

Not sure why you didn't lowercase IMG, WIDTH and HEIGHT here?

Quoted 13 lines
(quoted diff) +1 -1
 		       "\n\t-a PNG\n\t-h 200 -w 800\n",
 		       sensord_args.cgiDir, graph->image);
 
@@ -473,7 +473,7 @@
 			ret = applyToFeatures(rrdCGI_LINE, graph);
 		if (!ret && sensord_args.doLoad && graph->loadAvg)
 			ret = rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL);
-		printf (">\n</P>\n");
+		printf (">\n</p>\n");
 	}
 	printf("<p>\n<small><b>sensord</b> by "
 	       "<a href=\"mailto:[email protected]\">Merlin Hughes</a>"

Review line 487

Quoted 8 lines
(quoted diff) +1 -1
@@ -481,7 +481,7 @@
 	       "<a href=\"http://www.lm-sensors.org/\">lm_sensors</a> "
 	       "crew.</small>\n</p>\n");
 
-	printf("</BODY>\n</HTML>\n");
+	printf("</body>\n</html>\n");
 
 	return ret;
 }

Otherwise it looks good.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

Re: [lm-sensors] [PATCH 2/5] sensord: Convert CGI script to lower

In reply to Andre Prendel
Quoted 25 lines · Jean Delvare
Quoted 24 lines · Andre Prendel

This patch converts HTML code in the generated CGI script to lower case. This makes us a bit more XHTML compatible.
---

 rrd.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: sensors/prog/sensord/rrd.c
=================================> > --- sensors.orig/prog/sensord/rrd.c 2009-06-09 20:31:13.000000000 +0200
+++ sensors/prog/sensord/rrd.c 2009-06-09 22:05:04.000000000 +0200

(quoted diff) +3 -3
@@ -449,16 +449,16 @@
 {
 	int ret = 0, i;
 
-	printf("#!" RRDCGI "\n\n<HTML>\n"
-	       "<HEAD>\n<TITLE>sensord</TITLE>\n</HEAD>\n"
-	       "<BODY>\n<H1>sensord</H1>\n");
+	printf("#!" RRDCGI "\n\n<html>\n"
+	       "<head>\n<title>sensord</title>\n</head>\n"
+	       "<body>\n<h1>sensord</h1>\n");
 
 	for (i = 0; i < ARRAY_SIZE(graphs); i++) {
 		struct gr *graph = &graphs[i];
 
Quoted 8 lines

Review line 461

Quoted 6 lines
(quoted diff) +3 -3
-		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>'"
+		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>'"

Not sure why you didn't lowercase IMG, WIDTH and HEIGHT here?

I'm not sure whether rrdcgi expects only uppercase, because all the rrdcgi stuff is uppercase. Will check this and send an updated patch.

Quoted 16 lines
Quoted 16 lines
(quoted diff) +1 -1
 		       "\n\t-a PNG\n\t-h 200 -w 800\n",
 		       sensord_args.cgiDir, graph->image);
 
@@ -473,7 +473,7 @@
 			ret = applyToFeatures(rrdCGI_LINE, graph);
 		if (!ret && sensord_args.doLoad && graph->loadAvg)
 			ret = rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL);
-		printf (">\n</P>\n");
+		printf (">\n</p>\n");
 	}
 	printf("<p>\n<small><b>sensord</b> by "
 	       "<a href=\"mailto:[email protected]\">Merlin Hughes</a>"
@@ -481,7 +481,7 @@
 	       "<a href=\"http://www.lm-sensors.org/\">lm_sensors</a> "
 	       "crew.</small>\n</p>\n");
 
Quoted 10 lines

Review line 487

Quoted 5 lines
(quoted diff) +1 -1
-	printf("</BODY>\n</HTML>\n");
+	printf("</body>\n</html>\n");
 
 	return ret;
 }

Otherwise it looks good.

Signature · 1 line
Jean Delvare

Thanks,
Andre

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors