changeset 1496:f9010847a5f5

(get_system_name): Use gethostname for USG systems if HAVE_GETHOSTNAME is defined.
author Richard M. Stallman <rms@gnu.org>
date Thu, 29 Oct 1992 10:44:50 +0000
parents f17665e7347e
children 7117a3826501
files src/sysdep.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Thu Oct 29 06:29:20 1992 +0000
+++ b/src/sysdep.c	Thu Oct 29 10:44:50 1992 +0000
@@ -1539,17 +1539,27 @@
 #include <whoami.h>
 #endif
 
+/* Can't have this within the function since `static' is #defined to 
+   nothing for some USG systems.  */
 #ifdef USG
-/* Can't have this within the function since `static' is #defined to nothing */
+#ifdef HAVE_GETHOSTNAME
+static char get_system_name_name[256];
+#else /* not HAVE_GETHOSTNAME */
 static struct utsname get_system_name_name;
-#endif
+#endif /* not HAVE_GETHOSTNAME */
+#endif /* USG */
 
 char *
 get_system_name ()
 {
 #ifdef USG
+#ifdef HAVE_GETHOSTNAME
+  gethostname (get_system_name_name, sizeof (get_system_name_name));
+  return get_system_name_name;
+#else /* not HAVE_GETHOSTNAME */
   uname (&get_system_name_name);
   return (get_system_name_name.nodename);
+#endif /* not HAVE_GETHOSTNAME */
 #else /* Not USG */
 #ifdef BSD4_1
   return sysname;