From 3eca9ea3b514e23c043c8b36fd9794881be8e23b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 5 Nov 2016 22:37:44 +0100 Subject: channel.scm: Remove trailing bang from 'channel-send-eof'. This procedure merely does I/O without mutating its argument, so it does not deserve the trailing '!' (similar to Scheme's 'write', 'put-bytevector', etc. procedures). * libguile-ssh/channel-func.c (gssh_channel_send_eof_x): Rename to... (gssh_channel_send_eof): ... this. Change Scheme name to '%channel-send-eof'. Adjust caller. * modules/ssh/channel.scm (channel-send-eof!): Rename to... (channel-send-eof): ... this. * tests/client-server.scm ("channel-send-eof!"): Rename to... ("channel-send-eof"): ... this. Adjust accordingly. * doc/api-channels.texi (Channel Management): Adjust accordingly. Signed-off-by: Artyom V. Poptsov --- doc/api-channels.texi | 4 ++-- libguile-ssh/channel-func.c | 4 ++-- modules/ssh/channel.scm | 8 ++++---- tests/client-server.scm | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/api-channels.texi b/doc/api-channels.texi index e3231b0..97f1e49 100644 --- a/doc/api-channels.texi +++ b/doc/api-channels.texi @@ -132,7 +132,7 @@ Get the session to which belongs the @var{channel}. Throw @code{guile-ssh-error} on an error. Return the session. @end deffn -@deffn {Scheme Procedure} channel-send-eof! channel +@deffn {Scheme Procedure} channel-send-eof channel Send an end of file (EOF) on the @var{channel}. This action doesn't close the @var{channel}; you may still read from it but not write. Throw @code{guile-ssh-error} on an error. Return value is undefined. @@ -165,7 +165,7 @@ Example: ;; 'wc' reads data until EOF and writes its result ;; afterwards. - (channel-send-eof! p) + (channel-send-eof p) ;; Read the 'wc' output. (read-line p)) diff --git a/libguile-ssh/channel-func.c b/libguile-ssh/channel-func.c index c02286b..3f1a09a 100644 --- a/libguile-ssh/channel-func.c +++ b/libguile-ssh/channel-func.c @@ -468,9 +468,9 @@ SCM_DEFINE (guile_ssh_channel_is_open_p, "channel-open?", 1, 0, 0, return SCM_BOOL_F; } -SCM_GSSH_DEFINE (gssh_channel_send_eof_x, "%channel-send-eof!", +SCM_GSSH_DEFINE (gssh_channel_send_eof, "%channel-send-eof", 1, (SCM channel)) -#define FUNC_NAME s_gssh_channel_send_eof_x +#define FUNC_NAME s_gssh_channel_send_eof { struct channel_data *cd = _scm_to_channel_data (channel); scm_t_bits pt_bits; diff --git a/modules/ssh/channel.scm b/modules/ssh/channel.scm index 0fe4cb3..ec29238 100644 --- a/modules/ssh/channel.scm +++ b/modules/ssh/channel.scm @@ -39,7 +39,7 @@ ;; channel-set-stream! ;; channel-get-stream ;; channel-open? -;; channel-send-eof! +;; channel-send-eof ;; channel-eof? @@ -67,7 +67,7 @@ channel-get-session channel-get-exit-status channel-open? - channel-send-eof! + channel-send-eof channel-eof?)) (define* (make-channel session #:optional (mode OPEN_BOTH)) @@ -116,11 +116,11 @@ channel, and the second value is a port number on which the connection was issued." (%channel-accept-forward session timeout)) -(define (channel-send-eof! channel) +(define (channel-send-eof channel) "Send an end of file (EOF) on the CHANNEL. This action doesn't close the channel; you may still read from it but not write. Throw 'guile-ssh-error' on an error. Return value is undefined." - (%channel-send-eof! channel)) + (%channel-send-eof channel)) ;;; diff --git a/tests/client-server.scm b/tests/client-server.scm index 370f0d6..b56a329 100644 --- a/tests/client-server.scm +++ b/tests/client-server.scm @@ -652,7 +652,7 @@ ;; Client opens a channel to a server, sends data and then sends EOF on the ;; channel. Server reads data and sends it back. Client checks if the ;; channel is closed for output, and reads the data. -(test-assert-with-log "channel-send-eof!" +(test-assert-with-log "channel-send-eof" (run-client-test (lambda (server) (start-server/dt-test server @@ -665,7 +665,7 @@ (let ((channel (make-channel/dt-test session)) (str "Hello Scheme World!")) (write-line str channel) - (channel-send-eof! channel) + (channel-send-eof channel) (and (input-port? channel) (not (output-port? channel)) (string=? (read-line channel) str)))))))) -- cgit v1.2.3