[hackers] [sbase] writerune() should operate on a FILE * || sin
commit 18850f5dfa80bbc78038c147de5a85bf8878ec3e
Author: sin <sin_AT_2f30.org>
Date: Fri Nov 21 16:34:44 2014 +0000
writerune() should operate on a FILE *
diff --git a/expand.c b/expand.c
index 6c453fd..60c5623 100644
--- a/expand.c
+++ b/expand.c
_AT_@ -74,18 +74,18 @@ expand(const char *file, FILE *fp, int tabstop)
if (col)
col--;
bol = 0;
- writerune(&r);
+ writerune("<stdout>", stdout, &r);
break;
case '\n':
col = 0;
bol = 1;
- writerune(&r);
+ writerune("<stdout>", stdout, &r);
break;
default:
col++;
if (r != ' ')
bol = 0;
- writerune(&r);
+ writerune("<stdout>", stdout, &r);
break;
}
}
diff --git a/libutf/writerune.c b/libutf/writerune.c
index 0615860..eb9cfac 100644
--- a/libutf/writerune.c
+++ b/libutf/writerune.c
_AT_@ -7,16 +7,16 @@
#include "../utf.h"
void
-writerune(Rune *r)
+writerune(const char *file, FILE *fp, Rune *r)
{
char buf[UTFmax];
int n;
if ((n = runetochar(buf, r)) > 0) {
- fwrite(buf, n, 1, stdout);
- if (ferror(stdout)) {
- fprintf(stderr, "stdout: write error: %s\n",
- strerror(errno));
+ fwrite(buf, n, 1, fp);
+ if (ferror(fp)) {
+ fprintf(stderr, "%s: write error: %s\n",
+ file, strerror(errno));
exit(1);
}
}
diff --git a/utf.h b/utf.h
index 44c5bba..26b9a6f 100644
--- a/utf.h
+++ b/utf.h
_AT_@ -50,4 +50,4 @@ int isupperrune(Rune);
int isdigitrune(Rune);
int readrune(const char *, FILE *, Rune *);
-void writerune(Rune *);
+void writerune(const char *, FILE *, Rune *);
Received on Fri Nov 21 2014 - 17:35:01 CET
This archive was generated by hypermail 2.3.0
: Fri Nov 21 2014 - 17:36:11 CET