diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-04-10 22:18:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-04-10 22:18:50 -0700 |
commit | 6a350fd788f3114629c9993aa4d1ec5c292182f5 (patch) | |
tree | 5b2319bf1f8d7144bfadcf9055264e809017e750 /utf8.c | |
parent | cc9bd9efeb1a0b49819e086020c09656abeac768 (diff) | |
download | txr-6a350fd788f3114629c9993aa4d1ec5c292182f5.tar.gz txr-6a350fd788f3114629c9993aa4d1ec5c292182f5.tar.bz2 txr-6a350fd788f3114629c9993aa4d1ec5c292182f5.zip |
Functions open-fileno and fileno.
* stream.c (fd_k): New keyword variable.
(stdio_get_prop): Handle the :fd property by returning
the file descriptor.
(open_fileno): New function.
(stream_init): Initialize fd_k, and register fileno and open-fileno.
* stream.h (open_fileno): Declared.
* txr.1: Documented open-fileno and fileno.
* utf8.c (w_fdopen): New function.
* utf8.h (w_fdopen): Declared.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -387,6 +387,14 @@ FILE *w_freopen(const wchar_t *wname, const wchar_t *wmode, FILE *fold) return f; } +FILE *w_fdopen(int fd, const wchar_t *wmode) +{ + char *mode = utf8_dup_to(wmode); + FILE *f = fdopen(fd, mode); + free(mode); + return f; +} + int w_remove(const wchar_t *wpath) { char *path = utf8_dup_to(wpath); |