2003-09-30 17:47:41 +00:00
|
|
|
#include "lib9.h"
|
|
|
|
|
#include <bio.h>
|
|
|
|
|
#include <utf.h>
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
Bputrune(Biobuf *bp, long c)
|
|
|
|
|
{
|
|
|
|
|
Rune rune;
|
2009-09-11 17:03:06 -04:00
|
|
|
char str[UTFmax];
|
2003-09-30 17:47:41 +00:00
|
|
|
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;
|
|
|
|
|
}
|