about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--Rules4
-rw-r--r--misc/Makefile2
-rw-r--r--sunrpc/clnt_unix.c4
-rw-r--r--sunrpc/svc_unix.c6
-rw-r--r--sysdeps/generic/glob.c76
-rw-r--r--sysdeps/libm-ieee754/s_csqrt.c12
-rw-r--r--sysdeps/libm-ieee754/s_csqrtf.c12
-rw-r--r--sysdeps/libm-ieee754/s_csqrtl.c12
9 files changed, 99 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 7db898fbf6..a82df7e55f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 1998-07-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
 
+	* Rules (tests): Depend on tests-static only if build-static == yes.
+
+	* misc/Makefile (install-lib): Compile libbsd-compat.a and libg.a
+	only if build-static == yes.
+
+1998-07-29 12:58  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/generic/glob.c: Winblowz compatibility stuff.
+	Patch received from Paul D. Smith <psmith@BayNetworks.COM>.
+
+1998-07-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* sunrpc/clnt_unix.c (__msgwrite)[!SCM_CRED]: Add return
+	statement, fix typo.
+	* sunrpc/svc_unix.c (__msgwrite)[!SCM_CRED]: Likewise.
+
+1998-07-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
 	* manual/pattern.texi (More Flags for Globbing): Fix typo.
 
 	* manual/math.texi (Special Functions): Fix typo.
diff --git a/Rules b/Rules
index 0f9116b628..2353cc34a0 100644
--- a/Rules
+++ b/Rules
@@ -91,8 +91,12 @@ endif
 ifeq ($(cross-compiling),yes)
 tests: $(addprefix $(objpfx),$(tests) $(tests-static) $(test-srcs))
 else
+ifneq (($build-static),yes)
+tests: $(tests:%=$(objpfx)%.out)
+else
 tests: $(tests:%=$(objpfx)%.out) $(tests-static:%=$(objpfx)%.sout)
 endif
+endif
 
 ifeq ($(build-programs),yes)
 binaries-all = $(others) $(sysdep-others) $(tests) $(test-srcs)
diff --git a/misc/Makefile b/misc/Makefile
index 9365fd2a1a..7a233f5486 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -58,7 +58,9 @@ routines := brk sbrk sstk ioctl \
 	    err error ustat \
 	    getsysstats dirname regexp
 aux := init-misc
+ifeq ($(build-static),yes)
 install-lib := libbsd-compat.a libg.a
+endif
 gpl2lgpl := error.c error.h
 
 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent
diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 848b752e6b..64b9ca9731 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -466,14 +466,14 @@ __msgread (int sock, void *buf, size_t cnt)
 static int
 __msgwrite (int sock, void *buf, size_t cnt)
 {
-#ifndef SCM_CRED
+#ifndef SCM_CREDS
   /* We cannot implement this reliably.  */
   __set_errno (ENOSYS);
+  return -1;
 #else
   struct iovec iov[1];
   struct msghdr msg;
   struct cmessage cm;
-  int len;
 
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
index 59ae7a54e7..df56d9bd5c 100644
--- a/sunrpc/svc_unix.c
+++ b/sunrpc/svc_unix.c
@@ -294,7 +294,7 @@ __msgread (int sock, void *buf, size_t cnt)
 {
   struct iovec iov[1];
   struct msghdr msg;
-  int len, on = 1;
+  int on = 1;
 
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
@@ -315,13 +315,13 @@ __msgread (int sock, void *buf, size_t cnt)
 static int
 __msgwrite (int sock, void *buf, size_t cnt)
 {
-#ifndef SCM_CRED
+#ifndef SCM_CREDS
   /* We cannot implement this reliably.  */
   __set_errno (ENOSYS);
+  return -1;
 #else
   struct iovec iov[1];
   struct msghdr msg;
-  int len;
 
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index 2d7ee67ca3..7ab48995e2 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -496,6 +496,14 @@ glob (pattern, flags, errfunc, pglob)
 
   /* Find the filename.  */
   filename = strrchr (pattern, '/');
+#if defined __MSDOS__ || defined WINDOWS32
+  /* The case of "d:pattern".  Since `:' is not allowed in
+     file names, we can safely assume that wherever it
+     happens in pattern, it signals the filename part.  This
+     is so we could some day support patterns like "[a-z]:foo".  */
+  if (filename == NULL)
+    filename = strchr (pattern, ':');
+#endif /* __MSDOS__ || WINDOWS32 */
   if (filename == NULL)
     {
       /* This can mean two things: a simple name or "~name".  The later
@@ -506,7 +514,7 @@ glob (pattern, flags, errfunc, pglob)
 	  dirlen = strlen (pattern);
 
 	  /* Set FILENAME to NULL as a special flag.  This is ugly but
-	     other solutions would requiremuch more code.  We test for
+	     other solutions would require much more code.  We test for
 	     this special case below.  */
 	  filename = NULL;
 	}
@@ -532,6 +540,29 @@ glob (pattern, flags, errfunc, pglob)
     {
       char *newp;
       dirlen = filename - pattern;
+#if defined __MSDOS__ || defined WINDOWS32
+      if (*filename == ':'
+	  || (filename > pattern + 1 && filename[-1] == ':'))
+	{
+	  char *drive_spec;
+
+	  ++dirlen;
+	  drive_spec = (char *) __alloca (dirlen + 1);
+#ifdef HAVE_MEMPCPY
+	  *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0';
+#else
+	  memcpy (drive_spec, pattern, dirlen);
+	  drive_spec[dirlen] = '\0';
+#endif
+	  /* For now, disallow wildcards in the drive spec, to
+	     prevent infinite recursion in glob.  */
+	  if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE)))
+	    return GLOB_NOMATCH;
+	  /* If this is "d:pattern", we need to copy `:' to DIRNAME
+	     as well.  If it's "d:/pattern", don't remove the slash
+	     from "d:/", since "d:" and "d:/" are not the same.*/
+	}
+#endif
       newp = (char *) __alloca (dirlen + 1);
 #ifdef HAVE_MEMPCPY
       *((char *) mempcpy (newp, pattern, dirlen)) = '\0';
@@ -542,7 +573,13 @@ glob (pattern, flags, errfunc, pglob)
       dirname = newp;
       ++filename;
 
-      if (filename[0] == '\0' && dirlen > 1)
+      if (filename[0] == '\0'
+#if defined __MSDOS__ || defined WINDOWS32
+          && dirname[dirlen - 1] != ':'
+	  && (dirlen < 3 || dirname[dirlen - 2] != ':'
+	      || dirname[dirlen - 1] != '/')
+#endif
+	  && dirlen > 1)
 	/* "pattern/".  Expand "pattern", appending slashes.  */
 	{
 	  int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
@@ -905,8 +942,9 @@ glob (pattern, flags, errfunc, pglob)
 	    pglob->gl_flags = flags;
 
 	    /* Now we know how large the gl_pathv vector must be.  */
-	    new_pathv = realloc (pglob->gl_pathv,
-				 (pglob->gl_pathc + 1) * sizeof (char *));
+	    new_pathv = (char **) realloc (pglob->gl_pathv,
+					   ((pglob->gl_pathc + 1)
+					    * sizeof (char *)));
 	    if (new_pathv != NULL)
 	      pglob->gl_pathv = new_pathv;
 	  }
@@ -1026,11 +1064,31 @@ prefix_array (dirname, array, n)
 {
   register size_t i;
   size_t dirlen = strlen (dirname);
+#if defined __MSDOS__ || defined WINDOWS32
+  int sep_char = '/';
+# define DIRSEP_CHAR sep_char
+#else
+# define DIRSEP_CHAR '/'
+#endif
 
   if (dirlen == 1 && dirname[0] == '/')
     /* DIRNAME is just "/", so normal prepending would get us "//foo".
        We want "/foo" instead, so don't prepend any chars from DIRNAME.  */
     dirlen = 0;
+#if defined __MSDOS__ || defined WINDOWS32
+  else if (dirlen > 1)
+    {
+      if (dirname[dirlen - 1] == '/')
+	/* DIRNAME is "d:/".  Don't prepend the slash from DIRNAME.  */
+	--dirlen;
+      else if (dirname[dirlen - 1] == ':')
+	{
+	  /* DIRNAME is "d:".  Use `:' instead of `/'.  */
+	  --dirlen;
+	  sep_char = ':';
+	}
+    }
+#endif
 
   for (i = 0; i < n; ++i)
     {
@@ -1046,12 +1104,12 @@ prefix_array (dirname, array, n)
 #ifdef HAVE_MEMPCPY
       {
 	char *endp = (char *) mempcpy (new, dirname, dirlen);
-	*endp++ = '/';
+	*endp++ = DIRSEP_CHAR;
 	mempcpy (endp, array[i], eltlen);
       }
 #else
       memcpy (new, dirname, dirlen);
-      new[dirlen] = '/';
+      new[dirlen] = DIRSEP_CHAR;
       memcpy (&new[dirlen + 1], array[i], eltlen);
 #endif
       free ((__ptr_t) array[i]);
@@ -1131,7 +1189,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
       if (flags & (GLOB_NOCHECK|GLOB_NOMAGIC))
 	/* We need not do any tests.  The PATTERN contains no meta
 	   characters and we must not return an error therefore the
-	   result will always contain exactly the one name.  */
+	   result will always contain exactly one name.  */
 	flags |= GLOB_NOCHECK;
       else
 	{
@@ -1140,7 +1198,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
 	  struct stat st;
 	  size_t patlen = strlen (pattern);
 	  size_t dirlen = strlen (directory);
-	  char *fullname = __alloca (dirlen + 1 + patlen + 1);
+	  char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
 
 # ifdef HAVE_MEMPCPY
 	  mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
@@ -1154,7 +1212,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
 	  if (((flags & GLOB_ALTDIRFUNC)
 	       ? (*pglob->gl_stat) (fullname, &st)
 	       : __stat (fullname, &st)) == 0)
-	    /* We found this file to be existing.  No tell the rest
+	    /* We found this file to be existing.  Now tell the rest
 	       of the function to copy this name into the result.  */
 	    flags |= GLOB_NOCHECK;
 	}
diff --git a/sysdeps/libm-ieee754/s_csqrt.c b/sysdeps/libm-ieee754/s_csqrt.c
index ae106bdad8..a4dedf8806 100644
--- a/sysdeps/libm-ieee754/s_csqrt.c
+++ b/sysdeps/libm-ieee754/s_csqrt.c
@@ -84,7 +84,6 @@ __csqrt (__complex__ double x)
 	}
       else
 	{
-#if 0
 	  double d, r, s;
 
 	  d = __ieee754_hypot (__real__ x, __imag__ x);
@@ -98,20 +97,11 @@ __csqrt (__complex__ double x)
 	  else
 	    {
 	      s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x);
-	      r = (0.5 * __imag__ x) / s;
+	      r = fabs ((0.5 * __imag__ x) / s);
 	    }
 
 	  __real__ res = r;
 	  __imag__ res = __copysign (s, __imag__ x);
-#else
-	  double d, imag;
-
-	  d = __ieee754_hypot (__real__ x, __imag__ x);
-	  imag = __ieee754_sqrt (0.5 * (d - __real__ x));
-
-	  __real__ res = __ieee754_sqrt (0.5 * (d + __real__ x));
-	  __imag__ res = __copysign (imag, __imag__ x);
-#endif
 	}
     }
 
diff --git a/sysdeps/libm-ieee754/s_csqrtf.c b/sysdeps/libm-ieee754/s_csqrtf.c
index 015b0cd57f..3bc979f6e2 100644
--- a/sysdeps/libm-ieee754/s_csqrtf.c
+++ b/sysdeps/libm-ieee754/s_csqrtf.c
@@ -84,7 +84,6 @@ __csqrtf (__complex__ float x)
 	}
       else
 	{
-#if 0
 	  float d, r, s;
 
 	  d = __ieee754_hypotf (__real__ x, __imag__ x);
@@ -98,20 +97,11 @@ __csqrtf (__complex__ float x)
 	  else
 	    {
 	      s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x);
-	      r = (0.5f * __imag__ x) / s;
+	      r = fabsf ((0.5f * __imag__ x) / s);
 	    }
 
 	  __real__ res = r;
 	  __imag__ res = __copysignf (s, __imag__ x);
-#else
-	  float d, imag;
-
-	  d = __ieee754_hypotf (__real__ x, __imag__ x);
-	  imag = __ieee754_sqrtf (0.5 * (d - __real__ x));
-
-	  __real__ res = __ieee754_sqrtf (0.5 * (d + __real__ x));
-	  __imag__ res = __copysignf (imag, __imag__ x);
-#endif
 	}
     }
 
diff --git a/sysdeps/libm-ieee754/s_csqrtl.c b/sysdeps/libm-ieee754/s_csqrtl.c
index 4b7ed983d8..b806bc6785 100644
--- a/sysdeps/libm-ieee754/s_csqrtl.c
+++ b/sysdeps/libm-ieee754/s_csqrtl.c
@@ -84,7 +84,6 @@ __csqrtl (__complex__ long double x)
 	}
       else
 	{
-#if 0
 	  long double d, r, s;
 
 	  d = __ieee754_hypotl (__real__ x, __imag__ x);
@@ -98,20 +97,11 @@ __csqrtl (__complex__ long double x)
 	  else
 	    {
 	      s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
-	      r = (0.5L * __imag__ x) / s;
+	      r = fabsl ((0.5L * __imag__ x) / s);
 	    }
 
 	  __real__ res = r;
 	  __imag__ res = __copysignl (s, __imag__ x);
-#else
-	  long double d, imag;
-
-	  d = __ieee754_hypotl (__real__ x, __imag__ x);
-	  imag = __ieee754_sqrtl (0.5 * (d - __real__ x));
-
-	  __real__ res = __ieee754_sqrtl (0.5 * (d + __real__ x));
-	  __imag__ res = __copysignl (imag, __imag__ x);
-#endif
 	}
     }