Richard W.M. Jones' 5 patches that enables libssh2 to get cross-compiled with
mingw
Этот коммит содержится в:
родитель
95b73812e7
Коммит
5438cffd9a
@ -1,7 +1,7 @@
|
|||||||
# AC_PREREQ(2.57)
|
# AC_PREREQ(2.57)
|
||||||
AC_INIT(libssh2, [-], libssh2-devel@lists.sourceforge.net)
|
AC_INIT(libssh2, [-], libssh2-devel@lists.sourceforge.net)
|
||||||
AC_CONFIG_SRCDIR([src])
|
AC_CONFIG_SRCDIR([src])
|
||||||
AC_CONFIG_HEADER([src/libssh2_config.h example/simple/config.h])
|
AC_CONFIG_HEADER([src/libssh2_config.h])
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
dnl SED is needed by some of the tools
|
dnl SED is needed by some of the tools
|
||||||
@ -61,6 +61,7 @@ AC_PROG_CC
|
|||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
AC_LIBTOOL_WIN32_DLL
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
if test -z "$PKG_CONFIG"; then
|
if test -z "$PKG_CONFIG"; then
|
||||||
@ -258,6 +259,7 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
|
|||||||
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
|
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
|
||||||
AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
|
AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
|
||||||
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
||||||
|
AC_CHECK_HEADERS([windows.h ws2tcpip.h winsock2.h])
|
||||||
AC_CHECK_FUNCS(poll gettimeofday select strtoll)
|
AC_CHECK_FUNCS(poll gettimeofday select strtoll)
|
||||||
|
|
||||||
case $host in
|
case $host in
|
||||||
|
@ -10,6 +10,6 @@ noinst_PROGRAMS = ssh2 \
|
|||||||
sftp_RW_nonblock \
|
sftp_RW_nonblock \
|
||||||
sftpdir sftpdir_nonblock
|
sftpdir sftpdir_nonblock
|
||||||
|
|
||||||
INCLUDES = -I. -I$(top_srcdir)/include
|
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||||
LDADD = $(top_builddir)/src/libssh2.la
|
LDADD = $(top_builddir)/src/libssh2.la
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp.c,v 1.10 2007/08/09 01:10:11 dfandrich Exp $
|
* $Id: scp.c,v 1.11 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do a simple SCP transfer.
|
* Sample showing how to do a simple SCP transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp_nonblock.c,v 1.12 2008/09/30 08:55:35 bagder Exp $
|
* $Id: scp_nonblock.c,v 1.13 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SCP transfers in a non-blocking manner.
|
* Sample showing how to do SCP transfers in a non-blocking manner.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -94,7 +94,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance */
|
/* Create a session instance */
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp_write.c,v 1.5 2007/08/09 01:10:11 dfandrich Exp $
|
* $Id: scp_write.c,v 1.6 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do a simple SCP transfer.
|
* Sample showing how to do a simple SCP transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp_write_nonblock.c,v 1.8 2008/09/30 08:55:35 bagder Exp $
|
* $Id: scp_write_nonblock.c,v 1.9 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do a simple SCP transfer.
|
* Sample showing how to do a simple SCP transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
|
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -111,7 +111,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp.c,v 1.14 2007/09/24 12:14:18 bagder Exp $
|
* $Id: sftp.c,v 1.15 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP transfers.
|
* Sample showing how to do SFTP transfers.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k"
|
* "sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_RW_nonblock.c,v 1.11 2008/09/30 08:55:35 bagder Exp $
|
* $Id: sftp_RW_nonblock.c,v 1.12 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP transfers in a non-blocking manner.
|
* Sample showing how to do SFTP transfers in a non-blocking manner.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* Using the SFTP server running on 127.0.0.1
|
* Using the SFTP server running on 127.0.0.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Ultra basic "connect to port 22 on localhost"
|
/* Ultra basic "connect to port 22 on localhost"
|
||||||
@ -93,7 +93,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_mkdir.c,v 1.7 2007/08/09 01:10:11 dfandrich Exp $
|
* $Id: sftp_mkdir.c,v 1.8 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP mkdir
|
* Sample showing how to do SFTP mkdir
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
|
* "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_mkdir_nonblock.c,v 1.10 2008/09/30 08:55:35 bagder Exp $
|
* $Id: sftp_mkdir_nonblock.c,v 1.11 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP non-blocking mkdir.
|
* Sample showing how to do SFTP non-blocking mkdir.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
|
* "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -97,7 +97,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_nonblock.c,v 1.14 2008/09/30 08:55:35 bagder Exp $
|
* $Id: sftp_nonblock.c,v 1.15 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP non-blocking transfers.
|
* Sample showing how to do SFTP non-blocking transfers.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/secrets"
|
* "sftp 192.168.0.1 user password /tmp/secrets"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -100,7 +100,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance */
|
/* Create a session instance */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_write.c,v 1.8 2007/08/09 01:10:11 dfandrich Exp $
|
* $Id: sftp_write.c,v 1.9 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP write transfers.
|
* Sample showing how to do SFTP write transfers.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
|
* "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_write_nonblock.c,v 1.11 2008/09/30 08:55:35 bagder Exp $
|
* $Id: sftp_write_nonblock.c,v 1.12 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP non-blocking write transfers.
|
* Sample showing how to do SFTP non-blocking write transfers.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
|
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -112,7 +112,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftpdir.c,v 1.9 2007/08/09 01:10:11 dfandrich Exp $
|
* $Id: sftpdir.c,v 1.10 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample doing an SFTP directory listing.
|
* Sample doing an SFTP directory listing.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftpdir_nonblock.c,v 1.11 2008/09/30 08:55:35 bagder Exp $
|
* $Id: sftpdir_nonblock.c,v 1.12 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample doing an SFTP directory listing.
|
* Sample doing an SFTP directory listing.
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@ -97,7 +97,12 @@ int main(int argc, char *argv[])
|
|||||||
#elif defined(HAVE_IOCTLSOCKET)
|
#elif defined(HAVE_IOCTLSOCKET)
|
||||||
ioctlsocket(sock, FIONBIO, &flag);
|
ioctlsocket(sock, FIONBIO, &flag);
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long mode = 1;
|
||||||
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
#else
|
||||||
#error "add support for setting the socket non-blocking here"
|
#error "add support for setting the socket non-blocking here"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: ssh2.c,v 1.17 2007/08/09 01:10:11 dfandrich Exp $
|
* $Id: ssh2.c,v 1.18 2008/11/10 16:48:41 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SSH2 connect.
|
* Sample showing how to do SSH2 connect.
|
||||||
*
|
*
|
||||||
@ -9,10 +9,13 @@
|
|||||||
* "ssh2 host user password [-p|-i|-k]"
|
* "ssh2 host user password [-p|-i|-k]"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libssh2_config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_WINDOWS_H
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
@ -73,7 +76,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
WSAStartup(WINSOCK_VERSION, &wsadata);
|
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -41,6 +41,14 @@
|
|||||||
#define LIBSSH2_LIBRARY
|
#define LIBSSH2_LIBRARY
|
||||||
#include "libssh2_config.h"
|
#include "libssh2_config.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_WINDOWS_H
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WS2TCPIP_H
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The following CPP block should really only be in session.c and
|
/* The following CPP block should really only be in session.c and
|
||||||
packet.c. However, AIX have #define's for 'events' and 'revents'
|
packet.c. However, AIX have #define's for 'events' and 'revents'
|
||||||
and we are using those names in libssh2.h, so we need to include
|
and we are using those names in libssh2.h, so we need to include
|
||||||
@ -70,6 +78,28 @@
|
|||||||
#include "libssh2_publickey.h"
|
#include "libssh2_publickey.h"
|
||||||
#include "libssh2_sftp.h"
|
#include "libssh2_sftp.h"
|
||||||
|
|
||||||
|
/* Provide iovec / writev on WIN32 platform. */
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
/* same as WSABUF */
|
||||||
|
struct iovec {
|
||||||
|
u_long iov_len;
|
||||||
|
char *iov_base;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define inline __inline
|
||||||
|
|
||||||
|
static inline int writev(int sock, struct iovec *iov, int nvecs)
|
||||||
|
{
|
||||||
|
DWORD ret;
|
||||||
|
if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/* Needed for struct iovec on some platforms */
|
/* Needed for struct iovec on some platforms */
|
||||||
#ifdef HAVE_SYS_UIO_H
|
#ifdef HAVE_SYS_UIO_H
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user