shithub: kwa

Download patch

ref: aebe25cc3fb964bb660dfa956c702e64f125e6d5
parent: 0e21daeb990191793cea556ab63fd68e7b3b48ec
author: qwx <qwx@sciops.net>
date: Sat Oct 11 08:09:35 EDT 2025

format: fix %c not converting integers to runes

--- a/run.c
+++ b/run.c
@@ -933,19 +933,12 @@
 			sprint(p, fmt, t);
 			break;
 		case 5:
-			if (isnum(x)) {
-				if (getfval(x)) {
-					*p++ = (uchar)getfval(x);
-					*p = '\0';
-				} else {
-					*p++ = '\0';
-					*p = '\0';
-				}
-			} else {
+			if (isnum(x))
+				r = (Rune) getfval(x);
+			else
 				chartorune(&r, getsval(x));
-				p += runetochar(p, &r);
-				*p = '\0';
-			}
+			p += runetochar(p, &r);
+			*p = '\0';
 			break;
 		}
 		if (istemp(x))
--