1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-31 00:03:08 +03:00

Richard W.M. Jones' 5 patches that enables libssh2 to get cross-compiled with

mingw
This commit is contained in:
Daniel Stenberg
2008-11-10 16:48:41 +00:00
parent 95b73812e7
commit 5438cffd9a
17 changed files with 114 additions and 44 deletions

View File

@ -10,6 +10,6 @@ noinst_PROGRAMS = ssh2 \
sftp_RW_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

View File

@ -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.
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#ifdef HAVE_WINSOCK2_H
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {

View File

@ -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.
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#ifdef HAVE_WINSOCK2_H
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {
@ -94,7 +94,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance */

View File

@ -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.
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#ifdef HAVE_WINSOCK2_H
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {

View File

@ -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.
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {
@ -111,7 +111,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance

View File

@ -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.
*
@ -9,7 +9,7 @@
* "sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {

View File

@ -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.
*
@ -9,7 +9,7 @@
* Using the SFTP server running on 127.0.0.1
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
/* Ultra basic "connect to port 22 on localhost"
@ -93,7 +93,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance

View File

@ -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
*
@ -9,7 +9,7 @@
* "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {

View File

@ -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.
*
@ -9,7 +9,7 @@
* "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {
@ -97,7 +97,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance

View File

@ -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.
*
@ -9,7 +9,7 @@
* "sftp 192.168.0.1 user password /tmp/secrets"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {
@ -100,7 +100,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance */

View File

@ -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.
*
@ -9,7 +9,7 @@
* "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {

View File

@ -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.
*
@ -9,7 +9,7 @@
* "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_sftp.h>
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {
@ -112,7 +112,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance

View File

@ -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.
*
@ -9,7 +9,7 @@
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {

View File

@ -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.
*
@ -9,7 +9,7 @@
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {
@ -97,7 +97,12 @@ int main(int argc, char *argv[])
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance

View File

@ -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.
*
@ -9,10 +9,13 @@
* "ssh2 host user password [-p|-i|-k]"
*/
#include "config.h"
#include "libssh2_config.h"
#include <libssh2.h>
#include <libssh2_sftp.h>
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
@ -73,7 +76,7 @@ int main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsadata;
WSAStartup(WINSOCK_VERSION, &wsadata);
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
if (argc > 1) {