ref: d9eecc2d1a05bee01d8dc8d7c331f78c223bdce3
dir: /sys/src/libbio/bputrune.c/
#include <u.h>
#include <libc.h>
#include <bio.h>
int
Bputrune(Biobufhdr *bp, long c)
{
Rune rune;
char str[UTFmax];
int n;
rune = c;
if(rune < Runeself) {
Bputc(bp, rune);
return 1;
}
n = runetochar(str, &rune);
if(n == 0)
return Bbad;
if(Bwrite(bp, str, n) != n)
return Beof;
return n;
}