/* -*-C-*-
-$Id: ntsock.c,v 1.5 1999/01/02 06:11:34 cph Exp $
+$Id: ntsock.c,v 1.6 1999/08/13 18:29:38 cph Exp $
Copyright (c) 1997-1999 Massachusetts Institute of Technology
return (result);
}
}
+
+const char *
+OS_get_host_by_address (const char * host_addr)
+{
+ struct hostent * entry = (gethostbyaddr (host_addr));
+ if (entry == 0)
+ return (0);
+ {
+ char * result = (OS_malloc ((strlen (entry -> h_name)) + 1));
+ strcpy (result, (entry -> h_name));
+ return (result);
+ }
+}
\f
#ifndef SOCKET_LISTEN_BACKLOG
#define SOCKET_LISTEN_BACKLOG 5
/* -*-C-*-
-$Id: os2sock.c,v 1.10 1999/04/28 03:27:55 cph Exp $
+$Id: os2sock.c,v 1.11 1999/08/13 18:29:34 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
return (result);
}
}
+
+const char *
+OS_get_host_by_address (const char * host_addr)
+{
+ struct hostent * entry = (gethostbyaddr (host_addr));
+ if (entry == 0)
+ return (0);
+ {
+ char * result = (OS_malloc ((strlen (entry -> h_name)) + 1));
+ strcpy (result, (entry -> h_name));
+ return (result);
+ }
+}
\f
#ifndef SOCKET_LISTEN_BACKLOG
#define SOCKET_LISTEN_BACKLOG 5
/* -*-C-*-
-$Id: pruxsock.c,v 1.16 1999/01/02 06:11:34 cph Exp $
+$Id: pruxsock.c,v 1.17 1999/08/13 18:29:06 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
});
}
+DEFINE_PRIMITIVE ("GET-HOST-BY-ADDRESS", Prim_get_host_by_address, 1, 1, 0)
+{
+ PRIMITIVE_HEADER (1);
+ SOCKET_CODE
+ ({
+ CONST char * host_name = (OS_get_host_by_address (STRING_ARG (1)));
+ if (host_name == 0)
+ PRIMITIVE_RETURN (SHARP_F);
+ {
+ SCHEME_OBJECT result
+ = (char_pointer_to_string ((unsigned char *) host_name));
+ OS_free ((PTR) host_name);
+ PRIMITIVE_RETURN (result);
+ }
+ });
+}
+
#ifdef HAVE_SOCKETS
static char *
/* -*-C-*-
-$Id: uxsock.c,v 1.18 1999/01/02 06:11:34 cph Exp $
+$Id: uxsock.c,v 1.19 1999/08/13 18:29:28 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
#include "prims.h"
#include "limits.h"
-#ifndef _SUNOS4
+#ifdef 0
extern struct servent * EXFUN (getservbyname, (CONST char *, CONST char *));
-#endif
extern struct hostent * EXFUN (gethostbyname, (CONST char *));
+#endif
\f
Tchannel
DEFUN (OS_open_tcp_stream_socket, (host, port), char * host AND int port)
}
}
+CONST char *
+DEFUN (OS_get_host_by_address, (host_addr), CONST char * host_addr)
+{
+ struct hostent * entry = (UX_gethostbyaddr (host_addr, AF_INET));
+ if (entry == 0)
+ return (0);
+ {
+ char * result = (OS_malloc ((strlen (entry -> h_name)) + 1));
+ strcpy (result, (entry -> h_name));
+ return (result);
+ }
+}
+
Tchannel
DEFUN (OS_open_unix_stream_socket, (filename), CONST char * filename)
{
/* -*-C-*-
-$Id: uxsock.h,v 1.8 1999/01/02 06:11:34 cph Exp $
+$Id: uxsock.h,v 1.9 1999/08/13 18:29:18 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
extern char ** EXFUN (OS_get_host_by_name, (CONST char *));
CONST char * EXFUN (OS_get_host_name, (void));
CONST char * EXFUN (OS_canonical_host_name, (CONST char *));
+CONST char * EXFUN (OS_get_host_by_address, (CONST char *));
#ifdef HAVE_UNIX_SOCKETS
extern Tchannel EXFUN (OS_open_unix_stream_socket, (CONST char *));