Commit e36ba278 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(get_system_name): Use gethostname for USG systems

if HAVE_GETHOSTNAME is defined.
parent 94aa5d2d
......@@ -1539,17 +1539,27 @@ end_of_data ()
#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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment