Add new primitives GET-HOST-NAME and CANONICAL-HOST-NAME.
authorChris Hanson <org/chris-hanson/cph>
Sat, 1 Nov 1997 07:10:30 +0000 (07:10 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 1 Nov 1997 07:10:30 +0000 (07:10 +0000)
v7/src/microcode/pruxsock.c

index c9ae5b491657c3a0bdcf826607e60f56759881be..6e0a1443117a9327110a1ced9218de4bf886b3ca 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: pruxsock.c,v 1.11 1997/10/26 08:05:01 cph Exp $
+$Id: pruxsock.c,v 1.12 1997/11/01 07:10:30 cph Exp $
 
 Copyright (c) 1990-97 Massachusetts Institute of Technology
 
@@ -124,6 +124,40 @@ The result is a vector of strings, or #F if no such host exists.")
     });
 }
 
+DEFINE_PRIMITIVE ("GET-HOST-NAME", Prim_get_host_name, 0, 0, 0)
+{
+  PRIMITIVE_HEADER (0);
+  SOCKET_CODE
+    ({
+      CONST char * host_name = (OS_get_host_name ());
+      if (host_name == 0)
+       PRIMITIVE_RETURN (SHARP_F);
+      {
+       SCHEME_OBJECT result
+         = (char_pointer_to_string ((unsigned char *) host_name));
+       OS_free (host_name);
+       PRIMITIVE_RETURN (result);
+      }
+    });
+}
+
+DEFINE_PRIMITIVE ("CANONICAL-HOST-NAME", Prim_canonical_host_name, 1, 1, 0)
+{
+  PRIMITIVE_HEADER (1);
+  SOCKET_CODE
+    ({
+      CONST char * host_name = (OS_full_host_name (STRING_ARG (1)));
+      if (host_name == 0)
+       PRIMITIVE_RETURN (SHARP_F);
+      {
+       SCHEME_OBJECT result
+         = (char_pointer_to_string ((unsigned char *) host_name));
+       OS_free (host_name);
+       PRIMITIVE_RETURN (result);
+      }
+    });
+}
+
 #ifdef HAVE_SOCKETS
 
 static char *