From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Override Windows default Win-* key combinations when using Emacs Date: Sun, 28 Feb 2016 23:07:38 -0800 Organization: UCLA Computer Science Department Message-ID: <56D3EE3A.5090803@cs.ucla.edu> References: <568BBC58.50702@aprikoodi.fi> <83y4c43qkh.fsf@gnu.org> <5691667C.5000009@aprikoodi.fi> <838u3wkkvb.fsf@gnu.org> <5694E07E.8010005@aprikoodi.fi> <83fuy2kd2w.fsf@gnu.org> <56961607.2090504@aprikoodi.fi> <569634D6.6030404@aprikoodi.fi> <83oacpiial.fsf@gnu.org> <5697995B.5010306@aprikoodi.fi> <83mvs8gh7n.fsf@gnu.org> <83vb6tethb.fsf@gnu.org> <569A22D3.7070208@aprikoodi.fi> <56B207C0.3030304@aprikoodi.fi> <83mvrhyf4c.fsf@gnu.org> <838u27eo5p.fsf@gnu.org> <56D03005.3070809@aprikoodi.fi> <831t7ycrow.fsf@gnu.org> <56D2B300.80700@cs.ucla.edu> <83wppoal6o.fsf@gnu.org> <56D35297.9040507@cs.ucla.edu> <83bn70a94l.fsf@gnu.org> <56D38265.9000503@cs.ucla.edu> <83a8mk9oqd.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000808090800080005070907" X-Trace: ger.gmane.org 1456729756 18749 80.91.229.3 (29 Feb 2016 07:09:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Feb 2016 07:09:16 +0000 (UTC) Cc: jussi@aprikoodi.fi, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 29 08:09:07 2016 Return-path: Envelope-to: ged-emacs-devel@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 1aaHx3-00049l-Cg for ged-emacs-devel@m.gmane.org; Mon, 29 Feb 2016 08:09:05 +0100 Original-Received: from localhost ([::1]:34785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaHx2-0003IT-Nf for ged-emacs-devel@m.gmane.org; Mon, 29 Feb 2016 02:09:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaHvp-000102-O0 for emacs-devel@gnu.org; Mon, 29 Feb 2016 02:07:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaHvm-0006Hc-Lr for emacs-devel@gnu.org; Mon, 29 Feb 2016 02:07:49 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaHvi-0006Cz-31; Mon, 29 Feb 2016 02:07:42 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6CF8D16083D; Sun, 28 Feb 2016 23:07:39 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Y9JfYCFigz7s; Sun, 28 Feb 2016 23:07:38 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 60DC1160FDA; Sun, 28 Feb 2016 23:07:38 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wHa29mQufkSo; Sun, 28 Feb 2016 23:07:38 -0800 (PST) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 36F7616083D; Sun, 28 Feb 2016 23:07:38 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <83a8mk9oqd.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200805 Archived-At: This is a multi-part message in MIME format. --------------000808090800080005070907 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Eli Zaretskii wrote: >> The Gnulib getaddrinfo module is supposed to work on MS-Windows. If Emacs used >> >the Gnulib getaddrinfo module, the mainline Emacs code could be simplified by >> >assuming that getaddrinfo works. > But the non-getaddrinfo parts are not conditioned on MS-Windows in any > way. What about other systems that might be using them? Sorry, you've lost me. The non-getaddrinfo parts of Gnulib? Of Emacs? For what it's worth, the Gnulib getaddrinfo module is supposed to work on a wide variety of systems lacking getaddrinfo, not just on MS-Windows. I'm sure you mean something straightforward, it's just that I'm not getting it. What I was thinking was that we add the Gnulib getaddrinfo module, and apply something like the attached (untested) patch. --------------000808090800080005070907 Content-Type: text/x-diff; name="t.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="t.diff" diff --git a/lib-src/pop.c b/lib-src/pop.c index 57a5e52..55f2b10 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -962,13 +962,9 @@ static int have_winsock = 0; static int socket_connection (char *host, int flags) { -#ifdef HAVE_GETADDRINFO struct addrinfo *res, *it; struct addrinfo hints; int ret; -#else /* !HAVE_GETADDRINFO */ - struct hostent *hostent; -#endif struct servent *servent; struct sockaddr_in addr; char found_port = 0; @@ -1055,7 +1051,6 @@ socket_connection (char *host, int flags) } -#ifdef HAVE_GETADDRINFO memset (&hints, 0, sizeof (hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; @@ -1087,34 +1082,6 @@ socket_connection (char *host, int flags) } freeaddrinfo (res); -#else /* !HAVE_GETADDRINFO */ - do - { - hostent = gethostbyname (host); - try_count++; - if ((! hostent) && ((h_errno != TRY_AGAIN) || (try_count == 5))) - { - strcpy (pop_error, "Could not determine POP server's address"); - return (-1); - } - } while (! hostent); - - while (*hostent->h_addr_list) - { - memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length); - if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) - break; - hostent->h_addr_list++; - } - connect_ok = *hostent->h_addr_list != NULL; - if (! connect_ok) - { - realhost = alloca (strlen (hostent->h_name) + 1); - strcpy (realhost, hostent->h_name); - } - -#endif /* !HAVE_GETADDRINFO */ - #define CONNECT_ERROR "Could not connect to POP server: " if (! connect_ok) diff --git a/src/conf_post.h b/src/conf_post.h index 2788abf..b2eb2a2 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -122,7 +122,6 @@ typedef bool bool_bf; char *_getpty(); #endif #define INET6 /* Needed for struct sockaddr_in6. */ -#undef HAVE_GETADDRINFO /* IRIX has getaddrinfo but not struct addrinfo. */ #endif /* IRIX6_5 */ #ifdef MSDOS diff --git a/src/process.c b/src/process.c index d83e2d2..9a4bedf 100644 --- a/src/process.c +++ b/src/process.c @@ -3430,21 +3430,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses) } -#ifndef HAVE_GETADDRINFO -static Lisp_Object -conv_numerical_to_lisp (unsigned char *number, int length, int port) -{ - Lisp_Object address = Fmake_vector (make_number (length + 1), Qnil); - struct Lisp_Vector *p = XVECTOR (address); - - p->contents[length] = make_number (port); - for (int i = 0; i < length; i++) - p->contents[i] = make_number (number[i]); - - return address; -} -#endif - /* Create a network stream/datagram client/server process. Treated exactly like a normal process when reading and writing. Primary differences are in status display and process deletion. A network @@ -3615,11 +3600,9 @@ usage: (make-network-process &rest ARGS) */) Lisp_Object proc; Lisp_Object contact; struct Lisp_Process *p; -#if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A const char *portstring; ptrdiff_t portstringlen ATTRIBUTE_UNUSED; char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)]; -#endif #ifdef HAVE_LOCAL_SOCKETS struct sockaddr_un address_un; #endif @@ -3690,7 +3673,7 @@ usage: (make-network-process &rest ARGS) */) tem = Fplist_get (contact, QCfamily); if (NILP (tem)) { -#if defined (HAVE_GETADDRINFO) && defined (AF_INET6) +#ifdef AF_INET6 family = AF_UNSPEC; #else family = AF_INET; @@ -3762,7 +3745,6 @@ usage: (make-network-process &rest ARGS) */) } #endif -#if defined HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A if (!NILP (host)) { /* SERVICE can either be a string or int. @@ -3784,7 +3766,6 @@ usage: (make-network-process &rest ARGS) */) portstringlen = SBYTES (service); } } -#endif #ifdef HAVE_GETADDRINFO_A if (!NILP (host) && !NILP (Fplist_get (contact, QCnowait))) @@ -3816,7 +3797,6 @@ usage: (make-network-process &rest ARGS) */) } #endif /* HAVE_GETADDRINFO_A */ -#ifdef HAVE_GETADDRINFO /* If we have a host, use getaddrinfo to resolve both host and service. Otherwise, use getservbyname to lookup the service. */ @@ -3860,7 +3840,6 @@ usage: (make-network-process &rest ARGS) */) goto open_socket; } -#endif /* HAVE_GETADDRINFO */ /* We end up here if getaddrinfo is not defined, or in case no hostname has been specified (e.g. for a local server process). */ @@ -3899,47 +3878,6 @@ usage: (make-network-process &rest ARGS) */) xsignal1 (Qerror, CALLN (Fformat, unknown_service, service)); } -#ifndef HAVE_GETADDRINFO - if (!NILP (host)) - { - struct hostent *host_info_ptr; - unsigned char *addr; - int addrlen; - - /* gethostbyname may fail with TRY_AGAIN, but we don't honor that, - as it may `hang' Emacs for a very long time. */ - immediate_quit = 1; - QUIT; - -#ifdef HAVE_RES_INIT - res_init (); -#endif - - host_info_ptr = gethostbyname ((const char *) SDATA (host)); - immediate_quit = 0; - - if (host_info_ptr) - { - addr = (unsigned char *) host_info_ptr->h_addr; - addrlen = host_info_ptr->h_length; - } - else - /* Attempt to interpret host as numeric inet address. This - only works for IPv4 addresses. */ - { - unsigned long numeric_addr = inet_addr (SSDATA (host)); - - if (numeric_addr == -1) - error ("Unknown host \"%s\"", SDATA (host)); - - addr = (unsigned char *) &numeric_addr; - addrlen = 4; - } - - ip_addresses = list1 (conv_numerical_to_lisp (addr, addrlen, port)); - } -#endif /* not HAVE_GETADDRINFO */ - open_socket: if (!NILP (buffer)) --------------000808090800080005070907--