char *ctime_r(const time_t *l_clock, char *l_buf);
#endif
-#ifdef NEED_DECLARATION_CRYPT
+#if defined(NEED_DECLARATION_CRYPT) || !defined(HAVE_CRYPT)
char *crypt(char *key, char *salt);
#endif
int strcasecmp(char *s1, char *s2);
#endif
-#ifdef NEED_DECLARATION_INET_ATON
+#if defined(NEED_DECLARATION_INET_ATON) || !defined(HAVE_INET_ATON)
struct in_addr;
-int inet_aton(char *cp, struct in_addr *inp);
+int inet_aton(const char *cp, struct in_addr *inp);
#endif
#ifndef HAVE_SETLINEBUF
extern void freeaddrinfo (struct addrinfo *__ai);
/* Convert error return from getaddrinfo() to a string. */
-extern char *gai_strerror (int __ecode);
+extern const char *gai_strerror (int __ecode);
#endif
/* Translate a socket address to a location and service name. */
*/
#if defined(LOCAL_GETHOSTBYNAMER) || defined(LOCAL_GETHOSTBYADDRR)
#define BUFFER_OVERFLOW 255
-int copy_hostent(struct hostent *from, struct hostent *to,
- char *buffer, int buflen, int *error)
+static int copy_hostent(struct hostent *from, struct hostent *to,
+ char *buffer, int buflen, int *error)
{
int i, len;
char *ptr = buffer;
}
}
-char *
+const char *
gai_strerror(int ecode)
{
switch (ecode) {
port = htons(atoi(servname));
else {
struct servent *se;
- char *pe_proto;
+ const char *pe_proto;
switch (socktype) {
case SOCK_DGRAM:
char *serv, size_t servlen,
unsigned int flags)
{
- struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+ const struct sockaddr_in *sin = (const struct sockaddr_in *)sa;
struct hostent *hp;
struct hostent result;
char tmpserv[16];
/* Reverse DNS lookup required */
#ifdef GETHOSTBYADDRRSTYLE
#if GETHOSTBYADDRRSTYLE == SYSVSTYLE
- hp = gethostbyaddr_r((char *)&sin->sin_addr,
- sizeof(struct in_addr), AF_INET,
+ hp = gethostbyaddr_r((const char *)&sin->sin_addr,
+ salen, AF_INET,
&result, buffer, sizeof(buffer), &error);
#elif GETHOSTBYADDRRSTYLE == GNUSTYLE
- if (gethostbyaddr_r((char *)&sin->sin_addr,
- sizeof(struct in_addr), AF_INET,
+ if (gethostbyaddr_r((const char *)&sin->sin_addr,
+ salen, AF_INET,
&result, buffer, sizeof(buffer),
&hp, &error) != 0) {
hp = NULL;
}
#else
- hp = gethostbyaddr_r((char *)&sin->sin_addr,
- sizeof(struct in_addr), AF_INET,
+ hp = gethostbyaddr_r((const char *)&sin->sin_addr,
+ salen, AF_INET,
&result, buffer, sizeof(buffer), &error);
#endif
#else
- hp = gethostbyaddr_r((char *)&sin->sin_addr,
- sizeof(struct in_addr), AF_INET,
+ hp = gethostbyaddr_r((const char *)&sin->sin_addr,
+ salen, AF_INET,
&result, buffer, sizeof(buffer), &error);
#endif
if (hp)
}
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
/* int
* inet_pton6(src, dst)
* convert presentation level address to network order binary form.
continue;
}
if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
- inet_pton4(curtok, tp) > 0) {
+ inet_pton4(curtok, (struct in_addr *) tp) > 0) {
tp += INADDRSZ;
saw_xdigit = 0;
break; /* '\0' was seen by inet_pton4(). */
memcpy(dst, tmp, IN6ADDRSZ);
return (1);
}
+#endif
/*
* Utility function, so that the rest of the server doesn't