diff --git a/src/c/file.d b/src/c/file.d index 3adaf6953..cbedb4b7c 100755 --- a/src/c/file.d +++ b/src/c/file.d @@ -4993,14 +4993,20 @@ cl_streamp(cl_object strm) */ cl_object -si_copy_stream(cl_object in, cl_object out) +si_copy_stream(cl_object in, cl_object out, cl_object wait) { ecl_character c; + if ((wait == ECL_NIL) && !ecl_listen_stream(in)) { + return ECL_NIL; + } for (c = ecl_read_char(in); c != EOF; c = ecl_read_char(in)) { ecl_write_char(c, out); + if ((wait == ECL_NIL) && !ecl_listen_stream(in)) { + break; + } } ecl_force_output(out); - @(return ECL_T); + @(return c==EOF); } diff --git a/src/c/symbols_list.h b/src/c/symbols_list.h index 7630bd891..0c400815e 100755 --- a/src/c/symbols_list.h +++ b/src/c/symbols_list.h @@ -1141,7 +1141,7 @@ cl_symbols[] = { {SYS_ "COPY-TO-SIMPLE-BASE-STRING", SI_ORDINARY, si_copy_to_simple_base_string, 1, OBJNULL}, {SYS_ "COMPILED-FUNCTION-BLOCK", SI_ORDINARY, si_compiled_function_block, 1, OBJNULL}, {EXT_ "COMPILED-FUNCTION-NAME", EXT_ORDINARY, si_compiled_function_name, 1, OBJNULL}, -{SYS_ "COPY-STREAM", SI_ORDINARY, si_copy_stream, 1, OBJNULL}, +{SYS_ "COPY-STREAM", SI_ORDINARY, si_copy_stream, 3, OBJNULL}, {SYS_ "DESTRUCTURE", SI_ORDINARY, NULL, -1, OBJNULL}, {SYS_ "DO-READ-SEQUENCE", SI_ORDINARY, si_do_read_sequence, 4, OBJNULL}, {SYS_ "DO-WRITE-SEQUENCE", SI_ORDINARY, si_do_write_sequence, 4, OBJNULL}, diff --git a/src/cmp/proclamations.lsp b/src/cmp/proclamations.lsp index 05884ce53..2c58ed650 100644 --- a/src/cmp/proclamations.lsp +++ b/src/cmp/proclamations.lsp @@ -1152,7 +1152,7 @@ (proclamation si:open-unix-socket-stream (string) stream) #+wants-sockets (proclamation si:lookup-host-entry (t) (values (or null string) list list)) -(proclamation si:copy-stream (stream stream) t) +(proclamation si:copy-stream (stream stream wait) t) (proclamation si:make-encoding (t) hash-table) (proclamation si:load-encoding (t) t) diff --git a/src/h/external.h b/src/h/external.h index dba2dbda3..1d7b6870e 100755 --- a/src/h/external.h +++ b/src/h/external.h @@ -690,7 +690,7 @@ extern ECL_API cl_object cl_stream_external_format(cl_object strm); extern ECL_API cl_object cl_file_length(cl_object strm); extern ECL_API cl_object si_get_string_input_stream_index(cl_object strm); extern ECL_API cl_object si_make_string_output_stream_from_string(cl_object strng); -extern ECL_API cl_object si_copy_stream(cl_object in, cl_object out); +extern ECL_API cl_object si_copy_stream(cl_object in, cl_object out, cl_object wait); extern ECL_API cl_object cl_open_stream_p(cl_object strm); extern ECL_API cl_object cl_make_broadcast_stream _ECL_ARGS((cl_narg narg, ...)); extern ECL_API cl_object cl_broadcast_stream_streams(cl_object strm);