bputrune.c (314B) download
1#include "lib9.h"
2
3#include <bio.h>
4#include <utf.h>
5
6int Bputrune(Biobuf* bp, long c) {
7 Rune rune;
8 char str[UTFmax];
9 int n;
10
11 rune = c;
12 if (rune < Runeself) {
13 Bputc(bp, rune);
14 return 1;
15 }
16 n = runetochar(str, &rune);
17 if (n == 0)
18 return Bbad;
19 if (Bwrite(bp, str, n) != n)
20 return Beof;
21 return n;
22}