aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-15 20:30:19 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-15 20:30:19 +1300
commitdc71ce36c243b108d4def475c5925d62b3f2d5e6 (patch)
treecaced384601aefa5e3f25b17640db6aae5d00f80
parentMore portability notes (diff)
downloadwtf8-dc71ce36c243b108d4def475c5925d62b3f2d5e6.tar.gz
wtf8-dc71ce36c243b108d4def475c5925d62b3f2d5e6.zip
Remove - from format string
Doesn't seem to work on OpenBSD, which in retrospect seems like it might be dodgy; print it or a space explicitly first instead
-rw-r--r--wtf8.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/wtf8.c b/wtf8.c
index 3e09808..0b8f3a8 100644
--- a/wtf8.c
+++ b/wtf8.c
@@ -17,11 +17,10 @@ void print_octets(char *s) {
/*
* Iterate through the string, printing each octet
*/
- for (; *s; s++)
- printf(
- is_utf8_cont(*s) ? "-%02x" : " %02x",
- (unsigned char) *s
- );
+ for (; *s; s++) {
+ putchar(is_utf8_cont(*s) ? '-' : ' ');
+ printf("%02x", (unsigned char) *s);
+ }
/*
* End with a newline