summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-07 18:55:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-07 18:55:09 -0700
commit85e80eb7f9dcc3e24b8a2d618525a4ce901d3982 (patch)
tree6e6e90066658d62acf64bbffbad2e08a4d8cdbe7 /stream.c
parent52fb4be87f0b7c398084866393ac4ce3842272aa (diff)
downloadtxr-85e80eb7f9dcc3e24b8a2d618525a4ce901d3982.tar.gz
txr-85e80eb7f9dcc3e24b8a2d618525a4ce901d3982.tar.bz2
txr-85e80eb7f9dcc3e24b8a2d618525a4ce901d3982.zip
Argument of flush-stream now optional.
* stream.c (flush_stream): Default the argument to std_output. (stream_init): Register flush-stream as having one optional arg. * txr.1: Updated flush-stream description.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stream.c b/stream.c
index 358c6eac..86a6cb60 100644
--- a/stream.c
+++ b/stream.c
@@ -3222,8 +3222,9 @@ val put_lines(val lines, val stream)
return t;
}
-val flush_stream(val stream)
+val flush_stream(val stream_in)
{
+ val stream = default_arg(stream_in, std_output);
struct strm_ops *ops = coerce(struct strm_ops *, cobj_ops(stream, stream_s));
return ops->flush(stream);
}
@@ -3963,7 +3964,7 @@ void stream_init(void)
reg_fun(intern(lit("put-strings"), user_package), func_n2o(put_strings, 1));
reg_fun(intern(lit("unget-char"), user_package), func_n2o(unget_char, 1));
reg_fun(intern(lit("unget-byte"), user_package), func_n2o(unget_byte, 1));
- reg_fun(intern(lit("flush-stream"), user_package), func_n1(flush_stream));
+ reg_fun(intern(lit("flush-stream"), user_package), func_n1o(flush_stream, 0));
reg_fun(intern(lit("seek-stream"), user_package), func_n3(seek_stream));
reg_fun(intern(lit("truncate-stream"), user_package), func_n2(truncate_stream));
reg_fun(intern(lit("streamp"), user_package), func_n1(streamp));