From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.user Subject: Re: guile 2.0.9 build on mingw Date: Thu, 13 Jun 2013 16:41:44 +0300 Message-ID: <83hah2w2jr.fsf@gnu.org> References: <83sj1hv2ml.fsf@gnu.org> <874ndx9y7h.fsf@pobox.com> <83ip2bt4qk.fsf@gnu.org> <8761xqhyyt.fsf@gnu.org> <83li6mt18y.fsf@gnu.org> <83wqq3mcq9.fsf@gnu.org> <87k3m3kor5.fsf@gnu.org> <83ehcalysu.fsf@gnu.org> <87sj0pvl4a.fsf@tines.lan> <837gi1n3v5.fsf@gnu.org> <87k3m1vg8b.fsf@tines.lan> <83txl4lhby.fsf@gnu.org> <838v2fky99.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1371130921 4977 80.91.229.3 (13 Jun 2013 13:42:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Jun 2013 13:42:01 +0000 (UTC) Cc: guile-user@gnu.org To: mhw@netris.org, ludo@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jun 13 15:42:00 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Un7mq-0004ez-A3 for guile-user@m.gmane.org; Thu, 13 Jun 2013 15:42:00 +0200 Original-Received: from localhost ([::1]:59435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un7mp-00084i-V9 for guile-user@m.gmane.org; Thu, 13 Jun 2013 09:41:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un7md-00082J-GG for guile-user@gnu.org; Thu, 13 Jun 2013 09:41:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Un7mc-0007rv-6R for guile-user@gnu.org; Thu, 13 Jun 2013 09:41:47 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:65472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un7mb-0007rk-UY; Thu, 13 Jun 2013 09:41:46 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MOC007003BXEJ00@a-mtaout22.012.net.il>; Thu, 13 Jun 2013 16:41:35 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MOC007NI3DBE600@a-mtaout22.012.net.il>; Thu, 13 Jun 2013 16:41:35 +0300 (IDT) In-reply-to: <838v2fky99.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10437 Archived-At: The changes below work around the lack of h_error on Windows: --- libguile/net_db.c~0 2013-03-25 23:44:46.000000000 +0200 +++ libguile/net_db.c 2013-06-13 13:30:20.448923200 +0300 @@ -55,6 +55,47 @@ #include "libguile/net_db.h" #include "libguile/socket.h" +#ifdef __MINGW32__ +# define h_errno WSAGetLastError() +# define HAVE_H_ERRNO 1 +# define HAVE_HSTRERROR 1 +# ifdef HAVE_DECL_HSTRERROR +# undef HAVE_DECL_HSTRERROR +# endif +# define HAVE_DECL_HSTRERROR 1 +# define HOST_NOT_FOUND WSAHOST_NOT_FOUND +# define TRY_AGAIN WSATRY_AGAIN +# define NO_RECOVERY WSANO_RECOVERY +# define NO_DATA WSANO_DATA + +char *hstrerror (int); + +char * +hstrerror (int error_no) +{ + static char buf[500]; + DWORD ret; + + if (error_no == 0) + error_no = WSAGetLastError (); + + ret = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + error_no, + 0, /* choose most suitable language */ + buf, sizeof (buf), NULL); + + while (ret > 0 && (buf[ret - 1] == '\n' || + buf[ret - 1] == '\r' )) + --ret; + buf[ret] = '\0'; + if (!ret) + sprintf (buf, "Winsock error %u", error_no); + + return buf; +} +#endif /* __MINGW32__ */ #if defined (HAVE_H_ERRNO) /* Only wrap gethostbyname / gethostbyaddr if h_errno is available. */