fix trailing combining characters in all shf functions

This commit is contained in:
tg 2016-05-05 21:38:12 +00:00
parent 152eee2085
commit 370b3e6008

12
shf.c
View File

@ -25,7 +25,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.71 2016/05/05 21:29:24 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/shf.c,v 1.72 2016/05/05 21:38:12 tg Exp $");
/* flags to shf_emptybuf() */ /* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */ #define EB_READSW 0x01 /* about to switch to reading */
@ -1040,15 +1040,11 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
} else } else
field = 0; field = 0;
if (precision) {
const char *q;
nwritten += precision; nwritten += precision;
q = utf_skipcols(s, precision); precision = utf_skipcols(s, precision) - s;
while (s < q) { while (precision--)
shf_putc(*s++, shf); shf_putc(*s++, shf);
}
}
nwritten += field; nwritten += field;
while (field--) while (field--)
shf_putc(c, shf); shf_putc(c, shf);