Deleted Added
sdiff udiff text old ( 181110 ) new ( 181111 )
full compact
1/*
2 * Copyright (C) 2000-2003 Damien Miller. All rights reserved.
3 * Copyright (C) 1999 WIDE Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 37 unchanged lines hidden (view full) ---

46#ifndef HAVE_GETNAMEINFO
47int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
48 size_t hostlen, char *serv, size_t servlen, int flags)
49{
50 struct sockaddr_in *sin = (struct sockaddr_in *)sa;
51 struct hostent *hp;
52 char tmpserv[16];
53
54 if (serv != NULL) {
55 snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port));
56 if (strlcpy(serv, tmpserv, servlen) >= servlen)
57 return (EAI_MEMORY);
58 }
59
60 if (host != NULL) {
61 if (flags & NI_NUMERICHOST) {

--- 28 unchanged lines hidden (view full) ---

90{
91 switch (err) {
92 case EAI_NODATA:
93 return ("no address associated with name");
94 case EAI_MEMORY:
95 return ("memory allocation failure.");
96 case EAI_NONAME:
97 return ("nodename nor servname provided, or not known");
98 default:
99 return ("unknown/invalid error.");
100 }
101}
102#endif /* !HAVE_GAI_STRERROR */
103
104#ifndef HAVE_FREEADDRINFO
105void

--- 48 unchanged lines hidden (view full) ---

154 struct hostent *hp;
155 struct servent *sp;
156 struct in_addr in;
157 int i;
158 long int port;
159 u_long addr;
160
161 port = 0;
162 if (servname != NULL) {
163 char *cp;
164
165 port = strtol(servname, &cp, 10);
166 if (port > 0 && port <= 65535 && *cp == '\0')
167 port = htons(port);
168 else if ((sp = getservbyname(servname, NULL)) != NULL)
169 port = sp->s_port;

--- 59 unchanged lines hidden ---