summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bltin/printf.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/bltin/printf.c b/src/bltin/printf.c
index ec7c8c2..eaf14b6 100644
--- a/src/bltin/printf.c
+++ b/src/bltin/printf.c
@@ -98,20 +98,25 @@ static int print_escape_str(const char *f, int *param, int *array, char *s)
 	int total;
 
 	setstackmark(&smark);
-	done = conv_escape_str(s, &p);
-	q = stackblock();
-	len = p - q;
+	done = conv_escape_str(s, &q);
+	p = stackblock();
+	len = q - p;
+	total = len - 1;
+
+	if (f[1] == 's')
+		goto easy;
 
-	p = makestrspace(len, p);
-	memset(p, 'X', len - 1);
-	p[len - 1] = 0;
+	p = makestrspace(len, q);
+	memset(p, 'X', total);
+	p[total] = 0;
 
 	q = stackblock();
 	total = ASPF(&p, f, p);
 
 	len = strchrnul(p, 'X') - p;
-	memcpy(p + len, q, strchrnul(p + len, ' ') - (p + len));
+	memcpy(p + len, q, strspn(p + len, "X"));
 
+easy:
 	out1mem(p, total);
 
 	popstackmark(&smark);
anything... 2019-07-27Use braces in MakefileJune McEnroe 2019-07-08Remove NetHack from indexJune McEnroe 2019-04-08Don't install rc.kfcgi eitherJune McEnroe 2019-03-28Remove rc.kfcgiJune McEnroe I sent a better version of it to the port maintainer and it is now in the ports tree. 2019-01-16Reformat index.html with explore linkJune McEnroe 2019-01-16Return false from keydown handler in exploreJune McEnroe 2019-01-08Draw lines to tile edgeJune McEnroe 2019-01-08Factor out default pathsJune McEnroe 2019-01-08Remove incorrect default coordinatesJune McEnroe 2019-01-07Set img src when explore fragment changesJune McEnroe 2019-01-07Compress PNG data in imageJune McEnroe kcgi never enables compression for FastCGI. 2019-01-07madvise MADV_NOCORE in imageJune McEnroe 2019-01-07Add license notice to explore JavaScriptJune McEnroe 2019-01-07Add Q/Home binding in exploreJune McEnroe 2019-01-07Fix explore image URLJune McEnroe 2019-01-07Add HOME button, ssh link, AGPL notice to exploreJune McEnroe 2019-01-06Add meta viewport to exploreJune McEnroe 2019-01-06Set background and max-width in exploreJune McEnroe 2019-01-06Swallow writes after the connection is closedJune McEnroe It was not okay. 2019-01-06Handle KCGI_HUPJune McEnroe I hope it's okay that I keep writing to the fwopen stream after streamWrite returns -1. 2019-01-06Install html filesJune McEnroe