summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-05-04 06:36:17 +0000
committerAndreas Schneider <mail@cynapses.org>2009-05-04 06:36:17 +0000
commit98fbe3020d068ddae454cc5c4163943de04ce92c (patch)
treed8a0a311aae415728a12c464af7dfb1e2e37926d
parent9345ba70308ffb0431079f8491e0e85f97ebb168 (diff)
downloadlibssh-98fbe3020d068ddae454cc5c4163943de04ce92c.tar.gz
libssh-98fbe3020d068ddae454cc5c4163943de04ce92c.tar.xz
libssh-98fbe3020d068ddae454cc5c4163943de04ce92c.zip
Improve channel_is_* functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@690 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r--libssh/channels.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/libssh/channels.c b/libssh/channels.c
index 400a2461..b4ab1786 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -938,35 +938,48 @@ error:
return SSH_ERROR;
}
-/** \brief returns if the channel is open or not
- * \param channel channel
- * \return 0 if channel is closed, nonzero otherwise
- * \see channel_is_closed()
+/**
+ * @brief Check if the channel is open or not.
+ *
+ * @param channel The channel to check.
+ *
+ * @return 0 if channel is closed, nonzero otherwise.
+ *
+ * @see channel_is_closed()
*/
-int channel_is_open(CHANNEL *channel){
- return (channel->open!=0 && channel->session->alive);
+int channel_is_open(CHANNEL *channel) {
+ return (channel->open != 0 && channel->session->alive != 0);
}
-/** \brief returns if the channel is closed or not
- * \param channel channel
- * \return 0 if channel is opened, nonzero otherwise
- * \see channel_is_open()
+/**
+ * @brief Check if the channel is closed or not.
+ *
+ * @param channel The channel to check.
+ *
+ * @return 0 if channel is opened, nonzero otherwise.
+ *
+ * @see channel_is_open()
*/
-
-int channel_is_closed(CHANNEL *channel){
- return (channel->open==0 || !channel->session->alive);
+int channel_is_closed(CHANNEL *channel) {
+ return (channel->open == 0 || channel->session->alive == 0);
}
-/** \brief returns if the remote has sent an EOF
- * \param channel channel
- * \return 0 if there is no EOF, nonzero otherwise
+/**
+ * @brief Check if remote has sent an EOF.
+ *
+ * @param channel The channel to check.
+ *
+ * @return 0 if there is no EOF, nonzero otherwise.
*/
-int channel_is_eof(CHANNEL *channel){
- if((channel->stdout_buffer && buffer_get_rest_len(channel->stdout_buffer)
- >0) || (channel->stderr_buffer && buffer_get_rest_len(
- channel->stderr_buffer)>0))
- return 0;
- return (channel->remote_eof!=0);
+int channel_is_eof(CHANNEL *channel) {
+ if ((channel->stdout_buffer &&
+ buffer_get_rest_len(channel->stdout_buffer) > 0) ||
+ (channel->stderr_buffer &&
+ buffer_get_rest_len(channel->stderr_buffer) > 0)) {
+ return 0;
+ }
+
+ return (channel->remote_eof != 0);
}
/** \brief put the channel into nonblocking mode