aboutsummaryrefslogtreecommitdiff
path: root/src/libbio/bputrune.c
blob: a2eaa83ec28212f175c199290c7931c7ed11671f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include	"lib9.h"
#include	<bio.h>
#include	<utf.h>

int
Bputrune(Biobuf *bp, long c)
{
	Rune rune;
	char str[4];
	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;
}