aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-10-09 21:44:05 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-10-09 21:44:05 +0200
commit58294442d3589f464571ff86071a260e0f548d26 (patch)
tree355f2683d657ec44de047741b9fc8202d0c46d83
parent2e9c13dad00c038fe7fa0eb8e81fc8990cb8893c (diff)
downloadlibssh-58294442d3589f464571ff86071a260e0f548d26.tar.gz
libssh-58294442d3589f464571ff86071a260e0f548d26.tar.xz
libssh-58294442d3589f464571ff86071a260e0f548d26.zip
Moved samples into examples directory
-rw-r--r--CMakeLists.txt9
-rw-r--r--examples/CMakeLists.txt16
-rw-r--r--examples/sample.c (renamed from sample.c)8
-rw-r--r--examples/samplesshd.c (renamed from samplesshd.c)0
-rw-r--r--include/libssh/server.h3
5 files changed, 22 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5dedd36..78911617 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,13 +69,4 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
if (UNIX AND NOT WIN32)
add_subdirectory(examples)
- if (WITH_SFTP)
- add_executable(samplessh sample.c)
- target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
- endif (WITH_SFTP)
-
- if (WITH_SERVER)
- add_executable(samplesshd samplesshd.c)
- target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
- endif (WITH_SERVER)
endif (UNIX AND NOT WIN32)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 3dbf6151..ddc95a77 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -8,6 +8,7 @@ set(examples_SRCS
include_directories(
${LIBSSH_PUBLIC_INCLUDE_DIRS}
+ ${LIBSSH_PRIVATE_INCLUDE_DIRS}
)
add_executable(libssh_scp libssh_scp.c ${examples_SRCS})
@@ -16,3 +17,18 @@ add_executable(scp_download scp_download.c ${examples_SRCS})
target_link_libraries(libssh_scp ${LIBSSH_SHARED_LIBRARY})
target_link_libraries(scp_download ${LIBSSH_SHARED_LIBRARY})
+include_directories(
+ ${LIBSSH_PUBLIC_INCLUDE_DIRS}
+ ${LIBSSH_PRIVATE_INCLUDE_DIRS}
+)
+
+if (WITH_SFTP)
+ add_executable(samplessh sample.c)
+ target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
+endif (WITH_SFTP)
+
+if (WITH_SERVER)
+ add_executable(samplesshd samplesshd.c)
+ target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
+endif (WITH_SERVER)
+
diff --git a/sample.c b/examples/sample.c
index 62cd8131..c2aaa66e 100644
--- a/sample.c
+++ b/examples/sample.c
@@ -5,7 +5,7 @@ Copyright 2003-2009 Aris Adamantiadis
This file is part of the SSH Library
You are free to copy this file, modify it in any way, consider it being public
-domain. This does not apply to the rest of the library though, but it is
+domain. This does not apply to the rest of the library though, but it is
allowed to cut-and-paste working code from this file to any license of
program.
The goal is to show the API in action. It's not a reference on how terminal
@@ -142,7 +142,7 @@ static void select_loop(ssh_session session,ssh_channel channel){
int ret;
while(channel){
/* when a signal is caught, ssh_select will return
- * with SSH_EINTR, which means it should be started
+ * with SSH_EINTR, which means it should be started
* again. It lets you handle the signal the faster you
* can, like in this window changed example. Of course, if
* your signal handler doesn't call libssh at all, you're
@@ -179,7 +179,7 @@ static void select_loop(ssh_session session,ssh_channel channel){
} while (ret==EINTR || ret==SSH_EINTR);
// we already looked for input from stdin. Now, we are looking for input from the channel
-
+
if(channel && channel_is_closed(channel)){
ssh_log(session,SSH_LOG_RARE,"exit-status : %d\n",channel_get_exit_status(channel));
@@ -591,7 +591,7 @@ int main(int argc, char **argv){
exit(-1);
}
}
-
+
break;
case SSH_SERVER_ERROR:
free(hash);
diff --git a/samplesshd.c b/examples/samplesshd.c
index 4c8a5bc9..4c8a5bc9 100644
--- a/samplesshd.c
+++ b/examples/samplesshd.c
diff --git a/include/libssh/server.h b/include/libssh/server.h
index 681792cb..1b6e3e5d 100644
--- a/include/libssh/server.h
+++ b/include/libssh/server.h
@@ -111,7 +111,8 @@ LIBSSH_API void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind);
* @brief Accept an incoming ssh connection and initialize the session.
*
* @param ssh_bind The ssh server bind to accept a connection.
- *
+ * @param session A preallocated ssh session
+ * @see ssh_new
* @return A newly allocated ssh session, NULL on error.
*/
LIBSSH_API int ssh_bind_accept(SSH_BIND *ssh_bind, ssh_session session);