diff options
author | Jim Meyering <jim@meyering.net> | 1994-05-20 13:50:43 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-05-20 13:50:43 +0000 |
commit | b98b0e107f67055d20db6005b6dee676a79c06a7 (patch) | |
tree | c8c093359626907c5ed207d60fc5d6811da8e11b /src | |
parent | a0f30b3f2c9254411cce3cde1639980b623bcb75 (diff) | |
download | coreutils-b98b0e107f67055d20db6005b6dee676a79c06a7.tar.xz |
merge with 1.10 + local build mods
Diffstat (limited to 'src')
-rw-r--r-- | src/hostname.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/hostname.c b/src/hostname.c index 300dac405..441c08953 100644 --- a/src/hostname.c +++ b/src/hostname.c @@ -29,10 +29,32 @@ #endif #include <stdio.h> +#include <sys/types.h> #include "system.h" #include "long-options.h" +#if !defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO) && \ + defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H) +#include <limits.h> +#include <sys/systeminfo.h> + +int +sethostname (name, namelen) + char *name; + int namelen; +{ + /* Using sysinfo() is the SVR4 mechanism to set a hostname. */ + int result; + + result = sysinfo (SI_SET_HOSTNAME, name, namelen); + + return (result == -1 ? result : 0); +} + +#define HAVE_SETHOSTNAME 1 /* Now we have it... */ +#endif + void error (); char *xgethostname (); |