shithub: riscv

Download patch

ref: 536805bce3fb88d94fbb90e2d9e23fcef1287095
parent: e3aee39a389700ad821a1619f114e226c1bd42d0
author: cinap_lenrek <[email protected]>
date: Sun Feb 24 22:31:50 EST 2019

upas/scanmail: fix %.*s format in xprint(), improve mkfile

--- a/sys/src/cmd/upas/scanmail/common.c
+++ b/sys/src/cmd/upas/scanmail/common.c
@@ -624,7 +624,10 @@
 	while(*q && *q != ' ')
 		q++;
 
-	fprint(fd, "%s %.*s~%.*s~%.*s\n", type, (int)(m->sp-p), p, (int)(m->ep-m->sp), m->sp, (int)(q-m->ep), m->ep);
+	fprint(fd, "%s %.*s~%.*s~%.*s\n", type, 
+		utfnlen(p, m->sp-p), p,
+		utfnlen(m->sp, m->ep-m->sp), m->sp,
+		utfnlen(m->ep, q-m->ep), m->ep);
 }
 
 enum {
--- a/sys/src/cmd/upas/scanmail/mkfile
+++ b/sys/src/cmd/upas/scanmail/mkfile
@@ -1,5 +1,4 @@
 </$objtype/mkfile
-<../mkupas
 
 TARG=scanmail\
 	testscan
@@ -19,6 +18,8 @@
 
 </sys/src/cmd/mkmany
 CFLAGS=$CFLAGS -I../common
+
+<../mkupas
 
 scanmail.$O:	scanmail.c
 	$CC $CFLAGS scanmail.c