changeset 34:0a64a6b521cf

Improvements
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 11 Dec 2006 05:35:16 +0000
parents ac2d809a3dda
children ffd7a5124e9f
files colormap.c
diffstat 1 files changed, 4 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/colormap.c	Mon Dec 11 05:34:18 2006 +0000
+++ b/colormap.c	Mon Dec 11 05:35:16 2006 +0000
@@ -14,11 +14,7 @@
 	c = p = -1;
 	while ((k = fgetc(inFile)) != EOF) {
 		if (k == '\n') {
-			if (p != -1)
-				fprintf(outFile, "</span>");
-			
 			fprintf(outFile, "\n");
-			c = -1;
 		} else {
 			c = mcGetColor(k);
 			if (c != p) {
@@ -28,7 +24,7 @@
 	
 				if (k > 0) {
 					fprintf(outFile,
-					"<span class=\"c%d\">%c", c, k);
+					"<span class='%c'>%c", 'a'+c, k);
 				}
 			} else
 				fprintf(outFile, "%c", k);
@@ -46,11 +42,7 @@
 	c = p = -1;
 	while ((c = fgetc(inFile)) != EOF) {
 		if (c == 0xff) {
-			if (p != -1)
-				fprintf(outFile, "</span>");
-			
 			fprintf(outFile, "\n");
-			c = -1;
 		} else {
 			if (c != p) {
 				if (p != -1) {
@@ -61,13 +53,13 @@
 					DINT t = (c / 64), q = (c % 64);
 					if (t > 0) {
 						fprintf(outFile,
-						"<span style=\"color:%s;background:%s\">",
+						"<span style='color:%s;background:%s'>",
 						mapColors[mapPieces[q].col].css,
 						mapColors[t].css);
 					} else {
 						fprintf(outFile,
-						"<span class=\"c%d\">",
-						mapPieces[q].col);
+						"<span class='%c'>",
+						'a'+mapPieces[q].col);
 					}
 					
 					fprintf(outFile, "%c", mapPieces[q].c);
@@ -91,10 +83,6 @@
 	inFile = stdin;
 	outFile = stdout;
 	
-	fprintf(stderr,
-		"Usage: %s [\"title\" [-diff]] < input > output\n",
-		argv[0]);
-		
 	/* Output XHTML header */
 	if (argc >= 2)
 		mcXHTMLhead(outFile, argv[1]);