diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-03-14 06:33:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-03-14 06:33:55 -0700 |
commit | feb85af5ec767988ce6e5414e5cae1ebc15b0f74 (patch) | |
tree | 553c87c0dd1d6465153c2babe34d09deea9ef31b /stream.c | |
parent | 2326bc176a85e40310f170a2450d4f71c78c9469 (diff) | |
download | txr-feb85af5ec767988ce6e5414e5cae1ebc15b0f74.tar.gz txr-feb85af5ec767988ce6e5414e5cae1ebc15b0f74.tar.bz2 txr-feb85af5ec767988ce6e5414e5cae1ebc15b0f74.zip |
All stdio streams get line buffering with i mode.
* socket.c (open_sockfd): We no longer need to set
stream sockets to line buffered mode here;
it's done in set_mode_props.
* stream.c (set_mode_props): If the mode specifies interactive,
streams open for writing are also switched to line buffering.
* txr.1: Documented under open-file, and open-socket.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1236,8 +1236,13 @@ val normalize_mode(struct stdio_mode *m, val mode_str) val set_mode_props(const struct stdio_mode m, val stream) { - if (m.interactive) + if (m.interactive) { + struct stdio_handle *h = coerce(struct stdio_handle *, + cobj_handle(stream, stdio_stream_s)); + if (h->f && m.write) + setvbuf(h->f, (char *) NULL, _IOLBF, 0); stream_set_prop(stream, real_time_k, t); + } return stream; } |