1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-28 01:41:48 +03:00

Moved samples into examples directory

This commit is contained in:
Aris Adamantiadis
2009-10-09 21:44:05 +02:00
parent 2e9c13dad0
commit 58294442d3
5 changed files with 22 additions and 14 deletions

View File

@ -69,13 +69,4 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
if (UNIX AND NOT WIN32) if (UNIX AND NOT WIN32)
add_subdirectory(examples) 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) endif (UNIX AND NOT WIN32)

View File

@ -8,6 +8,7 @@ set(examples_SRCS
include_directories( include_directories(
${LIBSSH_PUBLIC_INCLUDE_DIRS} ${LIBSSH_PUBLIC_INCLUDE_DIRS}
${LIBSSH_PRIVATE_INCLUDE_DIRS}
) )
add_executable(libssh_scp libssh_scp.c ${examples_SRCS}) 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(libssh_scp ${LIBSSH_SHARED_LIBRARY})
target_link_libraries(scp_download ${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)

View File

@ -5,7 +5,7 @@ Copyright 2003-2009 Aris Adamantiadis
This file is part of the SSH Library This file is part of the SSH Library
You are free to copy this file, modify it in any way, consider it being public 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 allowed to cut-and-paste working code from this file to any license of
program. program.
The goal is to show the API in action. It's not a reference on how terminal 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; int ret;
while(channel){ while(channel){
/* when a signal is caught, ssh_select will return /* 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 * again. It lets you handle the signal the faster you
* can, like in this window changed example. Of course, if * can, like in this window changed example. Of course, if
* your signal handler doesn't call libssh at all, you're * 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); } while (ret==EINTR || ret==SSH_EINTR);
// we already looked for input from stdin. Now, we are looking for input from the channel // we already looked for input from stdin. Now, we are looking for input from the channel
if(channel && channel_is_closed(channel)){ if(channel && channel_is_closed(channel)){
ssh_log(session,SSH_LOG_RARE,"exit-status : %d\n",channel_get_exit_status(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); exit(-1);
} }
} }
break; break;
case SSH_SERVER_ERROR: case SSH_SERVER_ERROR:
free(hash); free(hash);

View File

@ -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. * @brief Accept an incoming ssh connection and initialize the session.
* *
* @param ssh_bind The ssh server bind to accept a connection. * @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. * @return A newly allocated ssh session, NULL on error.
*/ */
LIBSSH_API int ssh_bind_accept(SSH_BIND *ssh_bind, ssh_session session); LIBSSH_API int ssh_bind_accept(SSH_BIND *ssh_bind, ssh_session session);