diff options
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | examples/CMakeLists.txt | 16 | ||||
-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.h | 3 |
5 files changed, 22 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b5dedd3..7891161 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 3dbf615..ddc95a7 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 62cd813..c2aaa66 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 4c8a5bc..4c8a5bc 100644 --- a/samplesshd.c +++ b/examples/samplesshd.c diff --git a/include/libssh/server.h b/include/libssh/server.h index 681792c..1b6e3e5 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); |