summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2013-11-28 00:38:26 -0800
committerKaz Kylheku <kaz@kylheku.com>2013-11-28 00:38:26 -0800
commit4d5a53b6f2811e82e313b979e4b53fd2071f2107 (patch)
treec474222a44f186d24b96070da60ea75416ec93af /utf8.c
parent900322c2c899af14b991bcbf324b44a0ea7e163e (diff)
downloadtxr-4d5a53b6f2811e82e313b979e4b53fd2071f2107.tar.gz
txr-4d5a53b6f2811e82e313b979e4b53fd2071f2107.tar.bz2
txr-4d5a53b6f2811e82e313b979e4b53fd2071f2107.zip
* stream.c (struct stdio_handle): New member, mode.
(stdio_stream_mark): Mark the new member during gc. (stdio_seek): When we seek, we should reset the utf8 machine. (tail_strategy): New function. (tail_get_line, tail_get_char, tail_get_byte): Use tail_strategy for polling the file at EOF. (open_tail): Store the mode in the file handle. * utf8.c (w_freopen): New function. * utf8.h (w_freopen): Declared.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 27550be2..99e21978 100644
--- a/utf8.c
+++ b/utf8.c
@@ -371,3 +371,13 @@ FILE *w_popen(const wchar_t *wcmd, const wchar_t *wmode)
free(mode);
return f;
}
+
+FILE *w_freopen(const wchar_t *wname, const wchar_t *wmode, FILE *fold)
+{
+ char *name = utf8_dup_to(wname);
+ char *mode = utf8_dup_to(wmode);
+ FILE *f = freopen(name, mode, fold);
+ free(name);
+ free(mode);
+ return f;
+}