]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
merge with 1.10 + local build mods
authorJim Meyering <jim@meyering.net>
Fri, 20 May 1994 13:50:43 +0000 (13:50 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 20 May 1994 13:50:43 +0000 (13:50 +0000)
lib/xgethostname.c
old/sh-utils/ChangeLog
old/sh-utils/NEWS
src/hostname.c

index 86408e775d8b1eb310b3a869b70e48a0f5639241..9973b45bedc6eb17f2f577e30f97794177c235b2 100644 (file)
@@ -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);
index 5fd16714979a910b47fb617551087bc812b7c766..d9378dc0606cddb9b361fdeef606472c70328e0c 100644 (file)
@@ -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.
 
index 7bd07a0e96c2264fa9b1c804d162e91c81226678..27afdfaeb866dec4c4dd79fd8167b4a34afb9ff3 100644 (file)
@@ -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.
index 300dac405861beae39970a159eb2815f872ad2ce..441c08953ed709e22b7863ceba62d6c12a257b21 100644 (file)
 #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 ();