From 4d5a53b6f2811e82e313b979e4b53fd2071f2107 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 28 Nov 2013 00:38:26 -0800 Subject: * 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. --- utf8.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'utf8.c') 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; +} -- cgit v1.2.3