shithub: olednews

Download patch

ref: 8592776712b7d54043d044bda06380a58fb515cd
parent: 13c0aeb1e423687204de24be782b9d1e2b1bb414
author: glenda <glenda@narshaddaa>
date: Mon Apr 24 02:07:46 EDT 2023

some working fixes

--- a/textimg.c
+++ b/textimg.c
@@ -79,7 +79,7 @@
 	if (p.x == 0)
 		sysfatal("no length");
 
-	int ncharspline, nlines;
+	int ncharspline;//, nlines;
 	int h = 32;
 	int w = 126;
 	int y = 0;
@@ -87,7 +87,7 @@
 	int ms = 100;
 	long n;
 	ncharspline = w / p.x;
-	nlines = 2;	// i guess?
+	//nlines = 2;	// i guess?
 	char *buf;
 	buf = calloc(ncharspline, sizeof (char));
 	fprint(2, "ncharspline: %d\n", ncharspline);
@@ -95,10 +95,13 @@
 	if(n <= 0)
 		sysfatal("no bread in the bread box");
 	buf[n] = '\0';
+	for(i = 0; i < n; i++)
+		if(buf[i] == '\n' || buf[i] == '\r')
+			buf[i] = ' ';
 
 	for(;;){
 		Memimage *img;
-		fprint(2, "buf str: %s\n", buf);
+		//fprint(2, "buf str: %s\n", buf);
 
 		fd = open(path, OWRITE);
 		if(fd < 0){
@@ -122,12 +125,11 @@
 			y = 0;
 
 		char c;
-		GETC:
-			c = Bgetc(in);
-			if(c <= 0)
-				break;
-			if(c == '\n' || c == '\r')
-				c = ' ';
+		c = Bgetc(in);
+		if(c <= 0)
+			break;
+		if(c == '\n' || c == '\r')
+			c = ' ';
 
 		for(i = 0; i < n-1; i++)
 			buf[i] = buf[i+1];