2014-11-21 16:20:15 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "../utf.h"
|
|
|
|
|
|
|
|
void
|
2014-11-21 16:34:44 +00:00
|
|
|
writerune(const char *file, FILE *fp, Rune *r)
|
2014-11-21 16:20:15 +00:00
|
|
|
{
|
|
|
|
char buf[UTFmax];
|
|
|
|
int n;
|
|
|
|
|
|
|
|
if ((n = runetochar(buf, r)) > 0) {
|
2014-11-21 16:34:44 +00:00
|
|
|
fwrite(buf, n, 1, fp);
|
|
|
|
if (ferror(fp)) {
|
|
|
|
fprintf(stderr, "%s: write error: %s\n",
|
|
|
|
file, strerror(errno));
|
2014-11-21 16:20:15 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|