diff -ruN curl-7.28.1.orig/config.log curl-7.28.1/config.log --- curl-7.28.1.orig/config.log 1970-01-01 01:00:00.000000000 +0100 +++ curl-7.28.1/config.log 2013-03-06 02:05:55.000000000 +0100 @@ -0,0 +1,403 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by curl configure -, which was +generated by GNU Autoconf 2.64. Invocation command line was + + $ ./configure + +## --------- ## +## Platform. ## +## --------- ## + +hostname = debian +uname -m = i686 +uname -r = 2.6.32-5-686 +uname -s = Linux +uname -v = #1 SMP Sun Sep 23 09:49:36 UTC 2012 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/local/bin +PATH: /usr/bin +PATH: /bin +PATH: /usr/local/games +PATH: /usr/games +PATH: /gg/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:2730: checking whether to enable maintainer-specific portions of Makefiles +configure:2739: result: no +configure:2756: checking whether to enable debug build options +configure:2775: result: no +configure:2779: checking whether to enable compiler optimizer +configure:2800: result: (assumed) yes +configure:2812: checking whether to enable strict compiler warnings +configure:2831: result: no +configure:2835: checking whether to enable compiler warnings as errors +configure:2854: result: no +configure:2858: checking whether to enable curl debug memory tracking +configure:2877: result: no +configure:2891: checking whether to enable hiding of library internal symbols +configure:2912: result: yes +configure:2923: checking whether to enable c-ares for DNS lookups +configure:2945: result: no +configure:2967: checking for sed +configure:2986: found /bin/sed +configure:2999: result: /bin/sed +configure:3016: checking for grep +configure:3035: found /bin/grep +configure:3048: result: /bin/grep +configure:3064: checking for egrep +configure:3067: result: /bin/grep -E +configure:3167: checking for ar +configure:3186: found /usr/bin/ar +configure:3198: result: /usr/bin/ar +configure:3271: checking for a BSD-compatible install +configure:3339: result: /usr/bin/install -c +configure:3350: checking whether build environment is sane +configure:3387: result: yes +configure:3449: checking for gawk +configure:3479: result: no +configure:3449: checking for mawk +configure:3465: found /usr/bin/mawk +configure:3476: result: mawk +configure:3487: checking whether make sets $(MAKE) +configure:3509: result: yes +configure:3687: checking curl version +configure:3689: result: 7.28.1 +configure:3733: checking build system type +configure:3747: result: i686-pc-linux-gnu +configure:3767: checking host system type +configure:3780: result: i686-pc-linux-gnu +configure:3818: checking for style of include used by make +configure:3846: result: GNU +configure:3922: checking for gcc +configure:3938: found /usr/bin/gcc +configure:3949: result: gcc +configure:4178: checking for C compiler version +configure:4187: gcc --version >&5 +gcc (Debian 4.4.5-8) 4.4.5 +Copyright (C) 2010 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:4198: $? = 0 +configure:4187: gcc -v >&5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu +Thread model: posix +gcc version 4.4.5 (Debian 4.4.5-8) +configure:4198: $? = 0 +configure:4187: gcc -V >&5 +gcc: '-V' option must have argument +configure:4198: $? = 1 +configure:4187: gcc -qversion >&5 +gcc: unrecognized option '-qversion' +gcc: no input files +configure:4198: $? = 1 +configure:4219: checking for C compiler default output file name +configure:4241: gcc conftest.c >&5 +configure:4245: $? = 0 +configure:4282: result: a.out +configure:4298: checking whether the C compiler works +configure:4307: ./a.out +configure:4311: $? = 0 +configure:4326: result: yes +configure:4333: checking whether we are cross compiling +configure:4335: result: no +configure:4338: checking for suffix of executables +configure:4345: gcc -o conftest conftest.c >&5 +configure:4349: $? = 0 +configure:4371: result: +configure:4377: checking for suffix of object files +configure:4398: gcc -c conftest.c >&5 +configure:4402: $? = 0 +configure:4423: result: o +configure:4427: checking whether we are using the GNU C compiler +configure:4445: gcc -c conftest.c >&5 +configure:4445: $? = 0 +configure:4454: result: yes +configure:4463: checking whether gcc accepts -g +configure:4482: gcc -c -g conftest.c >&5 + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_build=i686-pc-linux-gnu +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_host=i686-pc-linux-gnu +ac_cv_objext=o +ac_cv_path_GREP=/bin/grep +ac_cv_path_SED=/bin/sed +ac_cv_path_ac_pt_AR=/usr/bin/ar +ac_cv_path_install='/usr/bin/install -c' +ac_cv_prog_AWK=mawk +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_cc_g=no +ac_cv_prog_make_make_set=yes +curl_cv_PATH_SEPARATOR=: + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +ACLOCAL='${SHELL} "/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/missing" --run aclocal-1.9' +AMDEPBACKSLASH='\' +AMDEP_FALSE='#' +AMDEP_TRUE='' +AMTAR='${SHELL} "/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/missing" --run tar' +AR='/usr/bin/ar' +AS='' +AUTOCONF='${SHELL} "/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/missing" --run autoconf' +AUTOHEADER='${SHELL} "/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/missing" --run autoheader' +AUTOMAKE='${SHELL} "/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/missing" --run automake-1.9' +AWK='mawk' +BUILD_LIBHOSTNAME_FALSE='' +BUILD_LIBHOSTNAME_TRUE='' +BUILD_UNITTESTS_FALSE='' +BUILD_UNITTESTS_TRUE='' +CC='gcc' +CCDEPMODE='' +CFLAGS='-g' +CFLAG_CURL_SYMBOL_HIDING='' +CONFIGURE_OPTIONS='""' +CPP='' +CPPFLAGS='' +CPPFLAG_CURL_STATICLIB='' +CROSSCOMPILING_FALSE='' +CROSSCOMPILING_TRUE='' +CURLDEBUG_FALSE='' +CURLDEBUG_TRUE='' +CURLVERSION='7.28.1' +CURL_CA_BUNDLE='' +CURL_CFLAG_EXTRAS='' +CURL_DISABLE_DICT='' +CURL_DISABLE_FILE='' +CURL_DISABLE_FTP='' +CURL_DISABLE_GOPHER='' +CURL_DISABLE_HTTP='' +CURL_DISABLE_IMAP='' +CURL_DISABLE_LDAP='' +CURL_DISABLE_LDAPS='' +CURL_DISABLE_POP3='' +CURL_DISABLE_PROXY='' +CURL_DISABLE_RTSP='' +CURL_DISABLE_SMTP='' +CURL_DISABLE_TELNET='' +CURL_DISABLE_TFTP='' +CURL_LIBS='' +CURL_NETWORK_LIBS='' +CYGPATH_W='echo' +DEFS='' +DEPDIR='.deps' +DLLTOOL='' +DOING_CURL_SYMBOL_HIDING_FALSE='' +DOING_CURL_SYMBOL_HIDING_TRUE='' +DOING_NATIVE_WINDOWS_FALSE='' +DOING_NATIVE_WINDOWS_TRUE='' +DSYMUTIL='' +DUMPBIN='' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +ENABLE_SHARED='' +EXEEXT='' +FGREP='' +GREP='/bin/grep' +HAVE_GNUTLS_SRP='' +HAVE_LDAP_SSL='' +HAVE_LIBZ='' +HAVE_LIBZ_FALSE='' +HAVE_LIBZ_TRUE='' +HAVE_NSS_INITCONTEXT='' +HAVE_SSLEAY_SRP='' +IDN_ENABLED='' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' +IPV6_ENABLED='' +KRB4_ENABLED='' +LD='' +LDFLAGS='' +LIBCURL_LIBS='' +LIBMETALINK_CFLAGS='' +LIBMETALINK_LDFLAGS='' +LIBMETALINK_LIBS='' +LIBOBJS='' +LIBS='' +LIBTOOL='' +LIPO='' +LN_S='' +LTLIBOBJS='' +MAINT='#' +MAINTAINER_MODE_FALSE='' +MAINTAINER_MODE_TRUE='#' +MAKEINFO='${SHELL} "/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/missing" --run makeinfo' +MANIFEST_TOOL='' +MANOPT='' +MIMPURE_FALSE='' +MIMPURE_TRUE='' +NM='' +NMEDIT='' +NO_UNDEFINED_FALSE='' +NO_UNDEFINED_TRUE='' +NROFF='' +OBJDUMP='' +OBJEXT='o' +OTOOL64='' +OTOOL='' +PACKAGE='curl' +PACKAGE_BUGREPORT='a suitable curl mailing list: http://curl.haxx.se/mail/' +PACKAGE_NAME='curl' +PACKAGE_STRING='curl -' +PACKAGE_TARNAME='curl' +PACKAGE_URL='' +PACKAGE_VERSION='-' +PATH='/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/gg/bin' +PATH_SEPARATOR=':' +PERL='' +PKGADD_NAME='cURL - a client that groks URLs' +PKGADD_PKG='HAXXcurl' +PKGADD_VENDOR='curl.haxx.se' +PKGCONFIG='' +RANDOM_FILE='' +RANLIB='' +REQUIRE_LIB_DEPS='' +SED='/bin/sed' +SET_MAKE='' +SHELL='/bin/bash' +SONAME_BUMP_FALSE='' +SONAME_BUMP_TRUE='' +SSL_ENABLED='' +STRIP='' +SUPPORT_FEATURES='' +SUPPORT_PROTOCOLS='' +TEST_SERVER_LIBS='' +USE_ARES='' +USE_AXTLS='' +USE_CPPFLAG_BUILDING_LIBCURL_FALSE='' +USE_CPPFLAG_BUILDING_LIBCURL_TRUE='' +USE_CPPFLAG_CURL_STATICLIB_FALSE='' +USE_CPPFLAG_CURL_STATICLIB_TRUE='' +USE_CYASSL='' +USE_DARWINSSL='' +USE_EMBEDDED_ARES_FALSE='' +USE_EMBEDDED_ARES_TRUE='' +USE_GNUTLS='' +USE_GNUTLS_NETTLE='' +USE_LIBRTMP='' +USE_LIBSSH2='' +USE_MANUAL_FALSE='' +USE_MANUAL_TRUE='' +USE_NSS='' +USE_OPENLDAP='' +USE_POLARSSL='' +USE_SCHANNEL='' +USE_SSLEAY='' +USE_WINDOWS_SSPI='' +VERSION='-' +VERSIONED_FLAVOUR='' +VERSIONED_SYMBOLS_FALSE='' +VERSIONED_SYMBOLS_TRUE='' +VERSIONNUM='071c01' +ac_ct_AR='' +ac_ct_CC='gcc' +ac_ct_DUMPBIN='' +am__fastdepCC_FALSE='' +am__fastdepCC_TRUE='' +am__include='include' +am__leading_dot='.' +am__quote='' +am__tar='${AMTAR} chof - "$$tardir"' +am__untar='${AMTAR} xf -' +bindir='${exec_prefix}/bin' +build='i686-pc-linux-gnu' +build_alias='' +build_cpu='i686' +build_os='linux-gnu' +build_vendor='pc' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +dvidir='${docdir}' +exec_prefix='NONE' +host='i686-pc-linux-gnu' +host_alias='' +host_cpu='i686' +host_os='linux-gnu' +host_vendor='pc' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +install_sh='/home/fab/morphos/morphoswb/apps/odyssey/thirdparty/curl/curl-7.28.1/install-sh' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +libext='' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +mkdir_p='mkdir -p --' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='NONE' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +subdirs='' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +/* confdefs.h */ +#define PACKAGE_NAME "curl" +#define PACKAGE_TARNAME "curl" +#define PACKAGE_VERSION "-" +#define PACKAGE_STRING "curl -" +#define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/" +#define PACKAGE_URL "" +#define PACKAGE "curl" +#define VERSION "-" +#define OS "i686-pc-linux-gnu" + +configure: caught signal 2 +configure: exit 1 diff -ruN curl-7.28.1.orig/include/curl/curlbuild.h curl-7.28.1/include/curl/curlbuild.h --- curl-7.28.1.orig/include/curl/curlbuild.h 2012-11-20 08:13:32.000000000 +0100 +++ curl-7.28.1/include/curl/curlbuild.h 2013-03-06 02:05:55.000000000 +0100 @@ -522,6 +522,20 @@ # define CURL_TYPEOF_CURL_SOCKLEN_T int # define CURL_SIZEOF_CURL_SOCKLEN_T 4 +#elif defined(__MORPHOS__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 +# define CURL_PULL_SYS_TYPES_H 1 + + /* ===================================== */ /* KEEP GENERIC GCC THE LAST ENTRY */ /* ===================================== */ diff -ruN curl-7.28.1.orig/lib/amigaos.c curl-7.28.1/lib/amigaos.c --- curl-7.28.1.orig/lib/amigaos.c 2012-04-25 17:29:20.000000000 +0200 +++ curl-7.28.1/lib/amigaos.c 2013-03-06 02:06:00.000000000 +0100 @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -18,60 +18,82 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * + * $Id: curl-7.28.1.diff,v 1.1 2013/03/06 01:14:26 fab Exp $ ***************************************************************************/ -#include "setup.h" - -#if defined(__AMIGA__) && !defined(__ixemul__) - -#include +#ifdef __AMIGA__ /* Any AmigaOS flavour */ #include "amigaos.h" +#include "vapor.h" +#include struct Library *SocketBase = NULL; extern int errno, h_errno; +// Threads support +struct MinList repliedMessages; +struct MsgPort *curlMsgPort = NULL; + +#undef __libnix__ + #ifdef __libnix__ #include void __request(const char *msg); #else -# define __request( msg ) Printf( msg "\n\a") +# define __request( msg ) Printf( msg "\n\a") #endif void Curl_amiga_cleanup() { - if(SocketBase) { - CloseLibrary(SocketBase); - SocketBase = NULL; - } + if(curlMsgPort) { + DeleteMsgPort(curlMsgPort); + curlMsgPort = NULL; + } + + if(SocketBase) { + CloseLibrary(SocketBase); + SocketBase = NULL; + } } bool Curl_amiga_init() { - if(!SocketBase) - SocketBase = OpenLibrary("bsdsocket.library", 4); + if(!SocketBase) + SocketBase = OpenLibrary("bsdsocket.library", 4); + + if(!SocketBase) { + __request("No TCP/IP Stack running!"); + return FALSE; + } + + if(SocketBaseTags( + SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno, +// SBTM_SETVAL(SBTC_HERRNOLONGPTR), (ULONG) &h_errno, + SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL", + TAG_DONE)) { + return FALSE; + } + + if(!curlMsgPort) { + curlMsgPort = CreateMsgPort(); + } + + if(!curlMsgPort) { + Curl_amiga_cleanup(); + return FALSE; + } - if(!SocketBase) { - __request("No TCP/IP Stack running!"); - return FALSE; - } - - if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno, - SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL", - TAG_DONE)) { - __request("SocketBaseTags ERROR"); - return FALSE; - } + NEWLIST(&repliedMessages); #ifndef __libnix__ - atexit(Curl_amiga_cleanup); + atexit(Curl_amiga_cleanup); #endif - return TRUE; + return TRUE; } #ifdef __libnix__ ADD2EXIT(Curl_amiga_cleanup,-50); #endif -#endif /* __AMIGA__ && ! __ixemul__ */ +#endif /* __AMIGA__ */ diff -ruN curl-7.28.1.orig/lib/amigaos.h curl-7.28.1/lib/amigaos.h --- curl-7.28.1.orig/lib/amigaos.h 2012-04-25 17:29:20.000000000 +0200 +++ curl-7.28.1/lib/amigaos.h 2013-03-06 02:06:00.000000000 +0100 @@ -23,7 +23,7 @@ ***************************************************************************/ #include "setup.h" -#if defined(__AMIGA__) && !defined(__ixemul__) +#if defined(__AMIGA__) || defined(__MORPHOS__) /* Any AmigaOS flavour */ bool Curl_amiga_init(); void Curl_amiga_cleanup(); diff -ruN curl-7.28.1.orig/lib/asyn-thread.c curl-7.28.1/lib/asyn-thread.c --- curl-7.28.1.orig/lib/asyn-thread.c 2012-03-08 20:35:24.000000000 +0100 +++ curl-7.28.1/lib/asyn-thread.c 2013-03-06 02:06:00.000000000 +0100 @@ -51,6 +51,10 @@ # include # endif #endif +#ifdef __MORPHOS__ +#include +#include +#endif #if (defined(NETWARE) && defined(__NOVELL_LIBC__)) #undef in_addr_t @@ -142,6 +146,9 @@ return CURLE_OK; } +#ifdef __MORPHOS__ +static void abort_resolver_thread(struct connectdata *); +#endif static void destroy_async_data(struct Curl_async *); /* @@ -149,6 +156,9 @@ */ void Curl_resolver_cancel(struct connectdata *conn) { +#ifdef __MORPHOS__ + abort_resolver_thread(conn); +#endif destroy_async_data(&conn->async); } @@ -171,6 +181,9 @@ #ifdef HAVE_GETADDRINFO struct addrinfo hints; #endif +#ifdef __MORPHOS__ + struct Library *localSocketBase; +#endif }; struct thread_data { @@ -187,6 +200,17 @@ #define CONN_THREAD_SYNC_DATA(conn) &(((conn)->async.os_specific)->tsd); +#ifdef __MORPHOS__ +void abort_resolver_thread(struct connectdata *conn) +{ + if(conn->async.os_specific) { + struct thread_data *td = (struct thread_data*) conn->async.os_specific; + if(td->thread_hnd != curl_thread_t_null) + Curl_thread_destroy(td->thread_hnd); + } +} +#endif + /* Destroy resolver thread synchronization data */ static void destroy_thread_sync_data(struct thread_sync_data * tsd) @@ -300,7 +324,12 @@ { struct thread_sync_data *tsd = (struct thread_sync_data *)arg; +#ifdef __MORPHOS__ + tsd->localSocketBase = OpenLibrary("bsdsocket.library", 0); + tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port, tsd->localSocketBase); +#else tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port); +#endif if(!tsd->res) { tsd->sock_error = SOCKERRNO; @@ -312,6 +341,11 @@ tsd->done = 1; Curl_mutex_release(tsd->mtx); +#ifdef __MORPHOS__ + CloseLibrary(tsd->localSocketBase); + tsd->localSocketBase = NULL; +#endif + return 0; } @@ -589,7 +623,7 @@ } /* fall-back to blocking version */ - return Curl_ipv4_resolve_r(hostname, port); + return Curl_ipv4_resolve_r(hostname, port, SocketBase); } #else /* !HAVE_GETADDRINFO */ diff -ruN curl-7.28.1.orig/lib/config.h curl-7.28.1/lib/config.h --- curl-7.28.1.orig/lib/config.h 1970-01-01 01:00:00.000000000 +0100 +++ curl-7.28.1/lib/config.h 2013-03-06 02:06:00.000000000 +0100 @@ -0,0 +1,163 @@ +#ifndef LIBCURL_CONFIG_AMIGAOS_H +#define LIBCURL_CONFIG_AMIGAOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: curl-7.28.1.diff,v 1.1 2013/03/06 01:14:26 fab Exp $ + ***************************************************************************/ + +#if defined(__AMIGA__) || defined(__MORPHOS__) /* Any AmigaOS flavour */ + +#define HAVE_ARPA_INET_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_CLOSESOCKET_CAMEL 1 +#define HAVE_GETHOSTBYADDR 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_IOCTLSOCKET_CAMEL 1 +#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 +#define HAVE_LIBCRYPTO 1 +#define HAVE_LIBSSL 1 +#define HAVE_LIBZ 1 +#define HAVE_LONGLONG 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_OPENSSL_CRYPTO_H 1 +#define HAVE_OPENSSL_ERR_H 1 +#define HAVE_OPENSSL_PEM_H 1 +#define HAVE_OPENSSL_RSA_H 1 +#define HAVE_OPENSSL_SSL_H 1 +#define HAVE_OPENSSL_X509_H 1 +#define HAVE_PERROR 1 +#define HAVE_PWD_H 1 +#define HAVE_RAND_EGD 1 +#define HAVE_RAND_STATUS 1 +#define HAVE_SELECT 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SGTTY_H 1 +#define HAVE_SIGNAL 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SIG_ATOMIC_T 1 +#define HAVE_SOCKET 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRICMP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRSTR 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SOCKIO_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TERMIO_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNAME 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 +#define HAVE_WRITABLE_ARGV 1 +#define HAVE_ZLIB_H 1 +#define HAVE_SYS_IOCTL_H 1 + +#define NEED_MALLOC_H 1 + +#define SIZEOF_SIZE_T 4 +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 + +#define USE_OPENSSL 1 +#define USE_SSLEAY 1 +#define CURL_DISABLE_LDAP 1 + + +#define OS "MorphOS" + +#define PACKAGE "curl" +#define PACKAGE_BUGREPORT "curl-bug@haxx.se" +#define PACKAGE_NAME "curl" +#define PACKAGE_STRING "curl -" +#define PACKAGE_TARNAME "curl" +#define PACKAGE_VERSION "-" +#define CURL_CA_BUNDLE "PROGDIR:curl-ca-bundle.crt" + +#define RETSIGTYPE void +#define SELECT_TYPE_ARG1 int +#define SELECT_TYPE_ARG234 (fd_set *) +#define SELECT_TYPE_ARG5 (struct timeval *) + +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +#define in_addr_t int + +#ifndef O_RDONLY +# define O_RDONLY 0x0000 +#endif + +#define HAVE_GETNAMEINFO 1 +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 int +#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG7 int + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 long +#define RECV_TYPE_ARG2 char * +#define RECV_TYPE_ARG3 long +#define RECV_TYPE_ARG4 long +#define RECV_TYPE_RETV long + +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 long +#define RECVFROM_TYPE_ARG2 char +#define RECVFROM_TYPE_ARG3 long +#define RECVFROM_TYPE_ARG4 long +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 long +#define RECVFROM_TYPE_RETV long + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 char * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#ifndef socklen_t +# define socklen_t int +#endif + +#define USE_THREADS_MORPHOS 1 + +//#undef HAVE_LIBRTMP +//#undef HAVE_LIBRTMP_RTMP_H + +#endif /* __AMIGA__ */ +#endif /* LIBCURL_CONFIG_AMIGAOS_H */ diff -ruN curl-7.28.1.orig/lib/curl_threads.c curl-7.28.1/lib/curl_threads.c --- curl-7.28.1.orig/lib/curl_threads.c 2012-03-08 20:35:24.000000000 +0100 +++ curl-7.28.1/lib/curl_threads.c 2013-03-06 02:06:00.000000000 +0100 @@ -94,6 +94,240 @@ return ret; } +#elif defined(USE_THREADS_MORPHOS) + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "vapor.h" + +#define D(x) + +struct ThreadStartMsg +{ + struct Message tsm_Msg; + void* tsm_Result; +}; + +struct ThreadHandle +{ + ULONG td_PID; + struct Process* td_Thread; + struct MsgPort* td_MsgPort; +}; + +struct ThreadStartMsgNode +{ + struct MinNode tsmn_Node; + struct ThreadHandle *tsmn_Thread; + struct ThreadStartMsg *tsmn_Msg; + ULONG tsmn_Replied; +}; + + +struct curl_actual_call +{ + unsigned int (*func)(void *); + void *arg; +}; + +static void *curl_thread_create_thunk(void *arg) +{ + struct curl_actual_call * ac = arg; + unsigned int (*func)(void *) = ac->func; + void *real_arg = ac->arg; + + free(ac); + + (*func)(real_arg); + + return 0; +} + +extern struct MsgPort *curlMsgPort; +extern struct MinList repliedMessages; + +curl_thread_t Curl_thread_create(unsigned int (*func) (void*), void *arg) +{ + curl_thread_t t; + struct curl_actual_call *ac = malloc(sizeof(struct curl_actual_call)); + + D(kprintf("[CURL] Curl_thread_create()\n")); + + if(!ac) + return curl_thread_t_null; + + t = (curl_thread_t) malloc(sizeof(*t)); + + if(t) + { + ac->func = func; + ac->arg = arg; + + t->td_PID = 0; + t->td_MsgPort = curlMsgPort; + + if(t->td_MsgPort) + { + struct ThreadStartMsgNode *n; + + n = (struct ThreadStartMsgNode *) malloc(sizeof(struct ThreadStartMsgNode)); + if(n) + { + struct ThreadStartMsg* startup_msg; + + startup_msg = (struct ThreadStartMsg*) malloc(sizeof(struct ThreadStartMsg)); + if(startup_msg) + { + memset(startup_msg, 0, sizeof(struct ThreadStartMsg)); + + startup_msg->tsm_Msg.mn_Node.ln_Type = NT_MESSAGE; + startup_msg->tsm_Msg.mn_ReplyPort = t->td_MsgPort; + startup_msg->tsm_Msg.mn_Length = sizeof (*startup_msg); + + t->td_Thread = CreateNewProcTags(NP_Entry, (ULONG) curl_thread_create_thunk, + NP_Name, (ULONG) "CURL resolver thread", + NP_CodeType, CODETYPE_PPC, + NP_StartupMsg, (ULONG) startup_msg, + NP_PPC_Arg1, (ULONG) ac, + TAG_DONE); + if(t->td_Thread) + { + NewGetTaskAttrs((struct Task *) t->td_Thread, &t->td_PID, sizeof(t->td_PID), TASKINFOTYPE_PID); + n->tsmn_Replied = FALSE; + n->tsmn_Thread = t; + n->tsmn_Msg = startup_msg; + ADDTAIL(&repliedMessages, n); + D(kprintf("[CURL] Adding node %p (thread %p, msg %p)\n", n, t, startup_msg)); + return t; + } + + free(startup_msg); + } + + free(n); + } + } + free(t); + } + + D(kprintf("[CURL] Curl_create_thread failed\n")); + + free(ac); + return curl_thread_t_null; +} + +void Curl_thread_destroy(curl_thread_t hnd) +{ + D(kprintf("Curl_thread_destroy %p\n", hnd)); + if(hnd != curl_thread_t_null) + { + struct Task *task; + Forbid(); + if(hnd->td_PID != 0 && (task = FindTaskByPID(hnd->td_PID))) + { + Signal(task, SIGBREAKF_CTRL_C); + } + Permit(); + } +} + +int Curl_thread_join(curl_thread_t *hnd) +{ + struct ThreadStartMsg* tsm; + ULONG processed = FALSE; + APTR n, m; + + D(kprintf("[CURL] Curl_thread_join(%p)\n", *hnd)); + + // Check if there were some replied messages for this thread already + ITERATELISTSAFE(n, m, &repliedMessages) + { + struct ThreadStartMsgNode *msgnode = (struct ThreadStartMsgNode *) n; + + // IF the thread has already replied before, free it and return + if(msgnode->tsmn_Thread == *hnd && msgnode->tsmn_Replied) + { + D(kprintf("[CURL] Found a previous reply for thread %p in node %p\n", msgnode->tsmn_Thread, n)); + + REMOVE(msgnode); + free(msgnode->tsmn_Msg); + free(msgnode); + processed = TRUE; + break; + } + } + + // The thread hasn't replied yet, wait for it + while(!processed) + { + D(kprintf("[CURL] Waiting for any thread termination\n")); + + WaitPort((*hnd)->td_MsgPort); + tsm = (struct ThreadStartMsg*) GetMsg((*hnd)->td_MsgPort); + if(tsm) + { + // We received a message, but not necessarily the one we're waiting for. See who it belongs to + APTR n, m; + + D(kprintf("[CURL] Received message %p\n", tsm)); + + ITERATELISTSAFE(n, m, &repliedMessages) + { + struct ThreadStartMsgNode *msgnode = (struct ThreadStartMsgNode *) n; + + if(msgnode->tsmn_Msg == tsm) + { + D(kprintf("[CURL] message %p belongs to node %p\n", tsm, msgnode)); + + // That's the thread we're waiting for + if(msgnode->tsmn_Thread == *hnd) + { + D(kprintf("[CURL] This message is for us\n")); + + REMOVE(msgnode); + free(msgnode->tsmn_Msg); + free(msgnode); + processed = TRUE; + break; + } + // It's not the thread we're waiting for. Mark it as replied and wait again + else + { + D(kprintf("[CURL] This message is NOT for us, mark it as replied\n")); + msgnode->tsmn_Replied = TRUE; + break; + } + } + } + } + } + + free(*hnd); + *hnd = curl_thread_t_null; + + D(kprintf("[CURL] Curl_thread_join() ok\n", *hnd)); + + return 1; +} + +void Curl_thread_abort_all(void) +{ + APTR n, m; + ITERATELISTSAFE(n, m, &repliedMessages) + { + struct ThreadStartMsgNode *msgnode = (struct ThreadStartMsgNode *) n; + Curl_thread_join(&(msgnode->tsmn_Thread)); + } +} + #elif defined(USE_THREADS_WIN32) curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*), diff -ruN curl-7.28.1.orig/lib/curl_threads.h curl-7.28.1/lib/curl_threads.h --- curl-7.28.1.orig/lib/curl_threads.h 2011-03-19 16:16:07.000000000 +0100 +++ curl-7.28.1/lib/curl_threads.h 2013-03-06 02:06:00.000000000 +0100 @@ -41,9 +41,20 @@ # define Curl_mutex_acquire(m) EnterCriticalSection(m) # define Curl_mutex_release(m) LeaveCriticalSection(m) # define Curl_mutex_destroy(m) DeleteCriticalSection(m) +#elif defined(USE_THREADS_MORPHOS) +struct ThreadHandle; +struct SignalSemaphore; +# define CURL_STDCALL +# define curl_mutex_t struct SignalSemaphore +# define curl_thread_t struct ThreadHandle * +# define curl_thread_t_null (struct ThreadHandle *)0 +# define Curl_mutex_init(m) InitSemaphore(m) +# define Curl_mutex_acquire(m) ObtainSemaphore(m) +# define Curl_mutex_release(m) ReleaseSemaphore(m) +# define Curl_mutex_destroy(m) #endif -#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) +#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) || defined(__MORPHOS__) curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*), void *arg); diff -ruN curl-7.28.1.orig/lib/file.c curl-7.28.1/lib/file.c --- curl-7.28.1.orig/lib/file.c 2012-11-13 22:04:27.000000000 +0100 +++ curl-7.28.1/lib/file.c 2013-03-06 02:06:00.000000000 +0100 @@ -50,7 +50,7 @@ #include #endif -#ifdef HAVE_FCNTL_H +#if defined(HAVE_FCNTL_H) || defined(__MORPHOS__) #include #endif @@ -187,7 +187,7 @@ char *real_path; struct FILEPROTO *file; int fd; -#ifdef DOS_FILESYSTEM +#if defined(DOS_FILESYSTEM) || defined(__MORPHOS__) int i; char *actual_path; #endif @@ -248,6 +248,11 @@ fd = open_readonly(actual_path, O_RDONLY|O_BINARY); file->path = actual_path; +#elif __MORPHOS__ + actual_path = real_path; + actual_path++; + fd = open(actual_path, O_RDONLY); /* no CR/LF translation! */ + file->path = actual_path; #else fd = open_readonly(real_path, O_RDONLY); file->path = real_path; @@ -554,7 +559,7 @@ if(data->state.resume_from) { if(data->state.resume_from != - lseek(fd, data->state.resume_from, SEEK_SET)) + lseek(fd, data->state.resume_from, SEEK_SET)) return CURLE_BAD_DOWNLOAD_RESUME; } diff -ruN curl-7.28.1.orig/lib/hostip4.c curl-7.28.1/lib/hostip4.c --- curl-7.28.1.orig/lib/hostip4.c 2012-03-08 20:35:24.000000000 +0100 +++ curl-7.28.1/lib/hostip4.c 2013-03-06 02:06:00.000000000 +0100 @@ -81,6 +81,11 @@ #ifdef CURLRES_SYNCH +#ifdef __MORPHOS__ +#include +extern struct Library *SocketBase; +#endif + /* * Curl_getaddrinfo() - the ipv4 synchronous version. * @@ -110,7 +115,7 @@ *waitp = 0; /* synchronous response only */ - ai = Curl_ipv4_resolve_r(hostname, port); + ai = Curl_ipv4_resolve_r(hostname, port, SocketBase); if(!ai) infof(conn->data, "Curl_ipv4_resolve_r failed for %s\n", hostname); @@ -119,6 +124,7 @@ #endif /* CURLRES_SYNCH */ #endif /* CURLRES_IPV4 */ +#ifndef __MORPHOS__ #if defined(CURLRES_IPV4) && !defined(CURLRES_ARES) /* @@ -313,4 +319,46 @@ return ai; } + #endif /* defined(CURLRES_IPV4) && !defined(CURLRES_ARES) */ +#else + +#define my_gethostbyname(__p0) \ + LP1(210, struct hostent *, gethostbyname, \ + const UBYTE *, __p0, a0, \ + , localSocketBase, 0, 0, 0, 0, 0, 0) + +Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, + int port, void *localSocketBase) +{ + Curl_addrinfo *ai = NULL; + struct hostent *h = NULL; + struct in_addr in; + + if(Curl_inet_pton(AF_INET, hostname, &in) > 0) + { + /* This is a dotted IP address 123.123.123.123-style */ + return Curl_ip2addr(AF_INET, &in, hostname, port); + + /* + * Here is code for platforms that don't have a thread safe + * getaddrinfo() nor gethostbyname_r() function or for which + * gethostbyname() is the preferred one. + */ + } + else + { + if(localSocketBase) + { + h = my_gethostbyname((void*)hostname); + } + } + + if(h) + { + ai = Curl_he2ai(h, port); + } + + return ai; +} +#endif diff -ruN curl-7.28.1.orig/lib/hostip.h curl-7.28.1/lib/hostip.h --- curl-7.28.1.orig/lib/hostip.h 2012-11-19 10:56:58.000000000 +0100 +++ curl-7.28.1/lib/hostip.h 2013-03-06 02:06:00.000000000 +0100 @@ -144,7 +144,7 @@ #endif /* IPv4 threadsafe resolve function used for synch and asynch builds */ -Curl_addrinfo *Curl_ipv4_resolve_r(const char * hostname, int port); +Curl_addrinfo *Curl_ipv4_resolve_r(const char * hostname, int port, void *localSocketBase); CURLcode Curl_async_resolved(struct connectdata *conn, bool *protocol_connect); diff -ruN curl-7.28.1.orig/lib/makefile curl-7.28.1/lib/makefile --- curl-7.28.1.orig/lib/makefile 1970-01-01 01:00:00.000000000 +0100 +++ curl-7.28.1/lib/makefile 2013-03-06 02:06:00.000000000 +0100 @@ -0,0 +1,25 @@ +# +# libcurl Makefile for AmigaOS ... +# + +# change the follow to where you have the AmiTCP SDK v4.3 includes: + +ATCPSDKI= /GG/netinclude + +CC = ppc-morphos-gcc +CFLAGS = -O2 -noixemul -D__MORPHOS_SHAREDLIBS -Dsocklen_t=int -D__AMIGA__ -fno-strict-aliasing -I. -I../include -I../include/curl -I../../../instdir/include -W -Wall -include /gg/includestd/errno.h + +include Makefile.inc +CSOURCES += amigaos.c +OBJS = $(CSOURCES:.c=.o) + +all: $(OBJS) + ar cru libcurl.a $(OBJS) + ranlib libcurl.a + +clean: + @rm -rf *.o *.a + +install: + $(INSTALL) -c ./libcurl.a /lib/libcurl.a + diff -ruN curl-7.28.1.orig/lib/makefile.amiga curl-7.28.1/lib/makefile.amiga --- curl-7.28.1.orig/lib/makefile.amiga 2012-04-25 17:29:20.000000000 +0200 +++ curl-7.28.1/lib/makefile.amiga 2013-03-06 02:06:00.000000000 +0100 @@ -6,9 +6,8 @@ ATCPSDKI= /GG/netinclude - -CC = m68k-amigaos-gcc -CFLAGS = -I$(ATCPSDKI) -m68020-60 -O2 -msoft-float -noixemul -g -I. -I../include -W -Wall +CC = gcc +CFLAGS = -O2 -noixemul -Dsocklen_t=int -D__AMIGA__ -fno-strict-aliasing -I. -I../include -I../include/curl -W -Wall include Makefile.inc OBJS = $(CSOURCES:.c=.o) @@ -17,5 +16,9 @@ ar cru libcurl.a $(OBJS) ranlib libcurl.a +clean: + @rm -rf *.o *.a + install: $(INSTALL) -c ./libcurl.a /lib/libcurl.a + diff -ruN curl-7.28.1.orig/lib/nonblock.c curl-7.28.1/lib/nonblock.c --- curl-7.28.1.orig/lib/nonblock.c 2012-04-25 17:29:20.000000000 +0200 +++ curl-7.28.1/lib/nonblock.c 2013-03-06 02:06:00.000000000 +0100 @@ -82,8 +82,13 @@ #elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) /* Amiga */ +#ifdef __MORPHOS__ + char f = (char) nonblock; + return IoctlSocket(sockfd, FIONBIO, (char *)&f); +#else long flags = nonblock ? 1L : 0L; return IoctlSocket(sockfd, FIONBIO, flags); +#endif #elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) diff -ruN curl-7.28.1.orig/lib/select.c curl-7.28.1/lib/select.c --- curl-7.28.1.orig/lib/select.c 2012-08-08 23:38:25.000000000 +0200 +++ curl-7.28.1/lib/select.c 2013-03-06 02:06:00.000000000 +0100 @@ -26,6 +26,10 @@ #include #endif +#ifdef __MORPHOS__ +#include +#endif + #if !defined(HAVE_SELECT) && !defined(HAVE_POLL_FINE) #error "We can't compile without select() or poll() support." #endif diff -ruN curl-7.28.1.orig/lib/setup.h curl-7.28.1/lib/setup.h --- curl-7.28.1.orig/lib/setup.h 2012-11-16 14:28:30.000000000 +0100 +++ curl-7.28.1/lib/setup.h 2013-03-06 02:06:00.000000000 +0100 @@ -58,8 +58,8 @@ # include "config-riscos.h" #endif -#ifdef __AMIGA__ -# include "config-amigaos.h" +#if defined(__AMIGA__) || defined(__MORPHOS__) +# include "config.h" #endif #ifdef __SYMBIAN32__ @@ -316,7 +316,9 @@ # include # include # include +#ifndef __MORPHOS__ # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +#endif # endif #endif @@ -531,7 +533,7 @@ /* now undef the stock libc functions just to avoid them being used */ # undef HAVE_GETADDRINFO # undef HAVE_GETHOSTBYNAME -#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) +#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) || defined(USE_THREADS_MORPHOS) # define CURLRES_ASYNCH # define CURLRES_THREADED #else diff -ruN curl-7.28.1.orig/lib/setup_once.h curl-7.28.1/lib/setup_once.h --- curl-7.28.1.orig/lib/setup_once.h 2012-04-25 17:29:20.000000000 +0200 +++ curl-7.28.1/lib/setup_once.h 2013-03-06 02:06:00.000000000 +0100 @@ -107,13 +107,11 @@ #define SEND_4TH_ARG 0 #endif - #if defined(__minix) /* Minix doesn't support recv on TCP sockets */ #define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ (RECV_TYPE_ARG2)(y), \ (RECV_TYPE_ARG3)(z)) - #elif defined(HAVE_RECV) /* * The definitions for the return type and arguments types diff -ruN curl-7.28.1.orig/lib/Unnamed.c curl-7.28.1/lib/Unnamed.c --- curl-7.28.1.orig/lib/Unnamed.c 1970-01-01 01:00:00.000000000 +0100 +++ curl-7.28.1/lib/Unnamed.c 2013-03-06 02:06:00.000000000 +0100 @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include "getaddrinfo.h" + +int +lookup_host (const char *host) +{ + struct addrinfo hints, *res; + int errcode; + char addrstr[100]; + void *ptr; + + memset (&hints, 0, sizeof (hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags |= AI_CANONNAME; + + errcode = getaddrinfo (host, NULL, &hints, &res); + if (errcode != 0) + { + perror ("getaddrinfo"); + return -1; + } + + printf ("Host: %s\n", host); + while (res) + { + inet_ntop (res->ai_family, res->ai_addr->sa_data, addrstr, 100); + + switch (res->ai_family) + { + case AF_INET: + ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr; + break; + case AF_INET6: + ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr; + break; + } + inet_ntop (res->ai_family, ptr, addrstr, 100); + printf ("IPv%d address: %s (%s)\n", res->ai_family == PF_INET6 ? 6 : 4, + addrstr, res->ai_canonname); + res = res->ai_next; + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + if (argc < 2) + exit (1); + return lookup_host (argv[1]); +} diff -ruN curl-7.28.1.orig/lib/vapor.h curl-7.28.1/lib/vapor.h --- curl-7.28.1.orig/lib/vapor.h 1970-01-01 01:00:00.000000000 +0100 +++ curl-7.28.1/lib/vapor.h 2013-03-06 02:06:00.000000000 +0100 @@ -0,0 +1,76 @@ +#ifndef VAPOR_MACROS_H +#define VAPOR_MACROS_H + +/* Exec list support macros */ +#ifndef EXEC_LISTS_H +#include +#endif + +/* following 2 macros DON'T return NULL when the list is empty ! */ +#ifndef FIRSTNODE +#define FIRSTNODE(l) ((APTR)((struct List*)l)->lh_Head) +#endif + +#ifndef LASTNODE +#define LASTNODE(l) ((APTR)((struct List*)l)->lh_TailPred) +#endif + +#ifndef NEXTNODE +#define NEXTNODE(n) ((APTR)((struct Node*)n)->ln_Succ) +#endif + +#ifndef PREVNODE +#define PREVNODE(n) ((APTR)((struct Node*)n)->ln_Pred) +#endif + +#ifndef FINDNAME +#define FINDNAME(l,n) ((APTR)FindName((struct List*)l,n)) +#endif + +#ifndef REMHEAD +#define REMHEAD(l) ((APTR)RemHead((struct List*)l)) +#endif + +#ifndef REMTAIL +#define REMTAIL(l) ((APTR)RemTail((struct List*)l)) +#endif + +#ifndef REMOVE +#define REMOVE(n) Remove((struct Node*)n) +#endif + +#ifndef ADDHEAD +#define ADDHEAD(l,n) AddHead((struct List*)l,(struct Node*)n) +#endif + +#ifndef ADDTAIL +#define ADDTAIL(l,n) AddTail((struct List*)l,(struct Node*)n) +#endif + +#ifndef ENQUEUE +#define ENQUEUE(l,n) Enqueue((struct List*)l,(struct Node*)n) +#endif + +#ifndef NEWLIST +#define NEWLIST(l) NewList((struct List*)l) +#endif + +#ifndef ISLISTEMPTY +#define ISLISTEMPTY(l) IsListEmpty(((struct List*)l)) +#endif + +/* + * Those functions are safe to use in an empty list, but do NOT remove list members + * within them ! + */ +#define ITERATELIST(node,list) for(node=FIRSTNODE(list);NEXTNODE(node);node=NEXTNODE(node)) +#define TRAVERSELIST(node,list) ITERATELIST(node,list) + +/* + * These routines are like the ones above, except that it's safe to remove and/or + * re-insert/free the node. + */ +#define ITERATELISTSAFE(node,nextnode,list) for(node=FIRSTNODE(list);(nextnode=NEXTNODE(node));node=nextnode) +#define TRAVERSELISTSAFE(node,nextnode,list) ITERATELISTSAFE(node,nextnode,list) + +#endif /* VAPOR_MACROS_H */