aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2016-03-07 18:54:25 -0800
committerPaul Eggert2016-03-07 18:55:20 -0800
commit59c7a5d71145d88933a535e222bdf30105e7d382 (patch)
tree04724485be6c619e6257873f7d05c2ae51bcbb64 /lib-src
parent6bc8689c042830ae8c13e34af993e8f923e47c9d (diff)
downloademacs-59c7a5d71145d88933a535e222bdf30105e7d382.tar.gz
emacs-59c7a5d71145d88933a535e222bdf30105e7d382.zip
Assume getaddrinfo in C code
* admin/CPP-DEFINES, configure.ac: Remove HAVE_GETADDRINFO, HAVE_H_ERRNO. All uses removed. * doc/lispref/processes.texi (Network, Network Processes), etc/NEWS: Say that port numbers can be integer strings. * lib-src/pop.c (h_errno) [!WINDOWSNT && !HAVE_H_ERRNO]: Remove decl. (socket_connection): Assume HAVE_GETADDRINFO. * lisp/mpc.el (mpc--proc-connect): * lisp/net/network-stream.el (open-network-stream): It’s now OK to use integer strings as port numbers. * src/process.c (conv_numerical_to_lisp) [!HAVE_GETADDRINFO]: Remove. (Fmake_network_process): Assume HAVE_GETADDRINFO.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/pop.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 21d721546b7..983993461b5 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -102,12 +102,6 @@ extern char *krb_realmofhost (/* char * */);
102#endif /* ! KERBEROS5 */ 102#endif /* ! KERBEROS5 */
103#endif /* KERBEROS */ 103#endif /* KERBEROS */
104 104
105#ifndef WINDOWSNT
106#ifndef HAVE_H_ERRNO
107extern int h_errno;
108#endif
109#endif
110
111static int socket_connection (char *, int); 105static int socket_connection (char *, int);
112static int pop_getline (popserver, char **); 106static int pop_getline (popserver, char **);
113static int sendline (popserver, const char *); 107static int sendline (popserver, const char *);
@@ -972,13 +966,9 @@ static int have_winsock = 0;
972static int 966static int
973socket_connection (char *host, int flags) 967socket_connection (char *host, int flags)
974{ 968{
975#ifdef HAVE_GETADDRINFO
976 struct addrinfo *res, *it; 969 struct addrinfo *res, *it;
977 struct addrinfo hints; 970 struct addrinfo hints;
978 int ret; 971 int ret;
979#else /* !HAVE_GETADDRINFO */
980 struct hostent *hostent;
981#endif
982 struct servent *servent; 972 struct servent *servent;
983 struct sockaddr_in addr; 973 struct sockaddr_in addr;
984 char found_port = 0; 974 char found_port = 0;
@@ -1065,7 +1055,6 @@ socket_connection (char *host, int flags)
1065 1055
1066 } 1056 }
1067 1057
1068#ifdef HAVE_GETADDRINFO
1069 memset (&hints, 0, sizeof (hints)); 1058 memset (&hints, 0, sizeof (hints));
1070 hints.ai_socktype = SOCK_STREAM; 1059 hints.ai_socktype = SOCK_STREAM;
1071 hints.ai_flags = AI_CANONNAME; 1060 hints.ai_flags = AI_CANONNAME;
@@ -1097,34 +1086,6 @@ socket_connection (char *host, int flags)
1097 } 1086 }
1098 freeaddrinfo (res); 1087 freeaddrinfo (res);
1099 1088
1100#else /* !HAVE_GETADDRINFO */
1101 do
1102 {
1103 hostent = gethostbyname (host);
1104 try_count++;
1105 if ((! hostent) && ((h_errno != TRY_AGAIN) || (try_count == 5)))
1106 {
1107 strcpy (pop_error, "Could not determine POP server's address");
1108 return (-1);
1109 }
1110 } while (! hostent);
1111
1112 while (*hostent->h_addr_list)
1113 {
1114 memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length);
1115 if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
1116 break;
1117 hostent->h_addr_list++;
1118 }
1119 connect_ok = *hostent->h_addr_list != NULL;
1120 if (! connect_ok)
1121 {
1122 realhost = alloca (strlen (hostent->h_name) + 1);
1123 strcpy (realhost, hostent->h_name);
1124 }
1125
1126#endif /* !HAVE_GETADDRINFO */
1127
1128#define CONNECT_ERROR "Could not connect to POP server: " 1089#define CONNECT_ERROR "Could not connect to POP server: "
1129 1090
1130 if (! connect_ok) 1091 if (! connect_ok)