diff options
author | chatty | 1994-07-06 11:04:29 +0000 |
---|---|---|
committer | chatty | 1994-07-06 11:04:29 +0000 |
commit | 65ae6594970cc1b0851a84d9481c29897c40d84b (patch) | |
tree | a35a7ce876fe16c2ee26ce19f06241c5da544e94 /comm/OLD | |
parent | 64e63aedc6a870046360f108424c7ae3f525596a (diff) | |
download | ivy-league-65ae6594970cc1b0851a84d9481c29897c40d84b.zip ivy-league-65ae6594970cc1b0851a84d9481c29897c40d84b.tar.gz ivy-league-65ae6594970cc1b0851a84d9481c29897c40d84b.tar.bz2 ivy-league-65ae6594970cc1b0851a84d9481c29897c40d84b.tar.xz |
gethostbyname -> uname
Diffstat (limited to 'comm/OLD')
-rw-r--r-- | comm/OLD/PortServer.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/comm/OLD/PortServer.cc b/comm/OLD/PortServer.cc index 6305c63..eeaa70d 100644 --- a/comm/OLD/PortServer.cc +++ b/comm/OLD/PortServer.cc @@ -22,6 +22,9 @@ #include <string.h> // sometimes, cuserid is declared in stdio.h ... #include <stdio.h> +#if 1 +#include <sys/utsname.h> +#endif #ifdef __osf__ extern "C" { #endif @@ -308,10 +311,19 @@ UchPortServer :: MakeKey (const char* key) if (*q == '%') { switch (*++q) { case 'h' : +#if 0 if (gethostname (p, sizeof (buffer) - (p - buffer)) < 0) { SysError (ErrWarn, "UchPortServer::MakeKey"); strcpy (p, "???"); } +#else + struct utsname un; + if (uname (&un) < 0) { + SysError (ErrWarn, "UchPortServer::MakeKey"); + strcpy (p, "???"); + } else + strncpy (p, un.nodename, sizeof (buffer) - (p - buffer)); +#endif break; case 'u' : { char* l = getlogin (); |