summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-05-20 13:50:43 +0000
committerJim Meyering <jim@meyering.net>1994-05-20 13:50:43 +0000
commitb98b0e107f67055d20db6005b6dee676a79c06a7 (patch)
treec8c093359626907c5ed207d60fc5d6811da8e11b
parenta0f30b3f2c9254411cce3cde1639980b623bcb75 (diff)
downloadcoreutils-b98b0e107f67055d20db6005b6dee676a79c06a7.tar.xz
merge with 1.10 + local build mods
-rw-r--r--lib/xgethostname.c4
-rw-r--r--old/sh-utils/ChangeLog28
-rw-r--r--old/sh-utils/NEWS3
-rw-r--r--src/hostname.c22
4 files changed, 54 insertions, 3 deletions
diff --git a/lib/xgethostname.c b/lib/xgethostname.c
index 86408e775..9973b45be 100644
--- a/lib/xgethostname.c
+++ b/lib/xgethostname.c
@@ -46,12 +46,12 @@ xgethostname ()
int err;
size = INITIAL_HOSTNAME_LENGTH;
+ hostname = xmalloc (size);
while (1)
{
- hostname = xmalloc (size);
hostname[size - 1] = '\0';
err = gethostname (hostname, size);
- if (err || hostname[size - 1] == '\0')
+ if (err == 0 && hostname[size - 1] == '\0')
break;
size *= 2;
hostname = xrealloc (hostname, size);
diff --git a/old/sh-utils/ChangeLog b/old/sh-utils/ChangeLog
index 5fd167149..d9378dc06 100644
--- a/old/sh-utils/ChangeLog
+++ b/old/sh-utils/ChangeLog
@@ -1,5 +1,33 @@
+Thu May 19 01:10:20 1994 Jim Meyering (meyering@comco.com)
+
+ * Version 1.10.
+
+ * lib/Makefile.in (DISTFILES): Add getdate.c and posixtm.c.
+
+ * src/Makefile.in (users.c): Use cp if hard link fails.
+ From Ian Lance Taylor.
+
+ * Makefile.in (dist): Change package name from shellutils to sh-utils.
+ That allows a hyphen and 5-character version number without exceeding
+ the 14-character limit on file name length. shellutils-1.10 would
+ have been too long.
+ * version.c: Update package name.
+
+ * hostname.c: Include <sys/types.h> before "system.h".
+ From Kaveh Ghazi and Karl Berry.
+
+ * hostname.c (sethostname) [!HAVE_SETHOSTNAME && HAVE_SYSINFO &&
+ HAVE_SYS_SYSTEMINFO_H && HAVE_LIMITS_H]: New function. SVR4 systems
+ prefer sysinfo over sethostname.
+ * configure.in (AC_HAVE_FUNCS): Add sysinfo.
+ (AC_HAVE_HEADERS): Add sys/systeminfo.h.
+ From Kaveh Ghazi.
+
Fri May 13 09:45:23 1994 Jim Meyering (meyering@comco.com)
+ * lib/xgethostname.c (xgethostname): Call xmalloc outside the loop.
+ Correct loop termination condition.
+
* pwd.c: Include <sys/types.h> before "system.h".
From Kaveh Ghazi.
diff --git a/old/sh-utils/NEWS b/old/sh-utils/NEWS
index 7bd07a0e9..27afdfaeb 100644
--- a/old/sh-utils/NEWS
+++ b/old/sh-utils/NEWS
@@ -1,4 +1,5 @@
-User visible changes in release 2.0
+User visible changes in release 1.10
+* change package name from shellutils to sh-utils
* add hostname, pwd, and users commands
* --version outputs the name of the utility as well as the package name
and version number.
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 ();