#else /* UKERNEL */
#include <stdio.h>
#include <sys/types.h>
+#include <stdlib.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
-#include <stdlib.h>
#include <direct.h>
#else
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <ctype.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#endif
#include <errno.h>
#include "afsutil.h"
tc = *ahost; /* look at the first char */
if (tc >= '0' && tc <= '9') {
numeric = 1;
- while (tc = *ptr++) {
+ while ((tc = *ptr++)) {
if (tc == '.') {
if (dots >= 3) {
numeric = 0;
tval = 0;
dots = 0;
bzero(addr, sizeof(addr));
- while (tc = *ahost++) {
+ while ((tc = *ahost++)) {
if (tc == '.') {
if (dots >= 3) return (struct hostent *) 0; /* too many dots */
addr[dots++] = tval;
} else {
addr = ntohl(addr);
sprintf(tbuffer, "%d.%d.%d.%d",
- ((addr>>24) & 0xff), ((addr>>16) & 0xff),
- ((addr>>8) & 0xff), ( addr & 0xff));
+ (int)((addr>>24) & 0xff), (int)((addr>>16) & 0xff),
+ (int)((addr>>8) & 0xff), (int)( addr & 0xff));
}
return tbuffer;
return (char *) inet_ntoa(temp);
}
+/* same as above, but to a non-static buffer, must be freed by called */
+char* afs_inet_ntoa_r(afs_uint32 addr, char *buf)
+{
+ int temp;
+
+ temp = ntohl(addr);
+ sprintf(buf, "%d.%d.%d.%d",
+ (temp >> 24 ) & 0xff,
+ (temp >> 16 ) & 0xff,
+ (temp >> 8 ) & 0xff,
+ (temp ) & 0xff);
+ return buf;
+}
+
/*
* gettmpdir() -- Returns pointer to global temporary directory string.
* Always succeeds. Never attempt to deallocate directory string.