summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-10-30 06:56:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-10-30 06:56:03 -0700
commita5ef87836c9dba23c187e361a70dddef87c03746 (patch)
tree5a655d49433ce4c39731d163c6ac5d3db518b27c /stream.h
parent6d473d8f5e391c05d36e3c3db78c2f578abaaa16 (diff)
downloadtxr-a5ef87836c9dba23c187e361a70dddef87c03746.tar.gz
txr-a5ef87836c9dba23c187e361a70dddef87c03746.tar.bz2
txr-a5ef87836c9dba23c187e361a70dddef87c03746.zip
streams: allow "b" flag on open-command.
Currently, using "rb" in open-command reports an error on GNU/Linux, due to popen not liking the "b" mode. On Cygwin, the "b" flag is useful with popen. * stream.c (normalize_mode_no_bin): New function. (open_command): Use normalize_mode_no_bin instead of normalize_mode to strip out the binary flag. This doesn't happen on Cygwin, though. * stream.h (normalize_mode_no_bin): Declared. * share/txr/stdlib/getput.tl (command-get-buf): Since we are getting binary data, pass the "rb" mode to open-command, now that it works. (command-put-buf): Add "b" flag to mode passed to open-command.
Diffstat (limited to 'stream.h')
-rw-r--r--stream.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/stream.h b/stream.h
index 149e9ded..17b64aa1 100644
--- a/stream.h
+++ b/stream.h
@@ -143,6 +143,7 @@ void stream_mark_op(val stream);
void stream_destroy_op(val stream);
struct stdio_mode parse_mode(val mode_str, struct stdio_mode m_dfl);
val normalize_mode(struct stdio_mode *m, val mode_str, struct stdio_mode m_dfl);
+val normalize_mode_no_bin(struct stdio_mode *m, val mode_str, struct stdio_mode m_dfl);
val set_mode_props(const struct stdio_mode m, val stream);
val generic_get_line(val stream);
val errno_to_string(val err);