summary refs log tree commit diff
path: root/sysdeps/generic/glob.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-24 12:58:36 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-24 12:58:36 +0000
commit6c202c68704b50016c4faba8d6445ab542b5f301 (patch)
treefb98ab84aee572c36755b83133187d96ab934164 /sysdeps/generic/glob.c
parentcc60175e8cecbedb4c555379c3c667c9cf9420fa (diff)
downloadglibc-6c202c68704b50016c4faba8d6445ab542b5f301.tar.gz
glibc-6c202c68704b50016c4faba8d6445ab542b5f301.tar.xz
glibc-6c202c68704b50016c4faba8d6445ab542b5f301.zip
Update.
1998-07-24  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/glob.c (glob): Fix problems with handle tilde.
	Reported by Brian Wellington <bwelling@anomaly.munge.com>.

	* elf/elf.h: Really define Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed,
	and Elf64_Vernaux.

1998-07-24  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* configure.in: Recognize pgcc as compiler.
	Reported by sauron@angband.ee.ualberta.ca.

1998-07-02  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nscd/dbg_log.c: Make sure, that debug message is really written.
	* nscd/nscd.c: Don't use daemon(), set signal handler after fork.

	SVID more for gamma(x) with x integer <= 0.
Diffstat (limited to 'sysdeps/generic/glob.c')
-rw-r--r--sysdeps/generic/glob.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index 56bc0fbd53..63347bdb20 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -490,13 +490,25 @@ glob (pattern, flags, errfunc, pglob)
   filename = strrchr (pattern, '/');
   if (filename == NULL)
     {
-      filename = pattern;
+      /* This can mean two things: a simple name or "~name".  The later
+	 case is nothing but a notation for a directory.  */
+      if ((flags & GLOB_TILDE) && pattern[0] == '~')
+	{
+	  dirname = pattern;
+	  dirlen = strlen (pattern);
+
+	  filename = "";
+	}
+      else
+	{
+	  filename = pattern;
 #ifdef _AMIGA
-      dirname = (char *) "";
+	  dirname = (char *) "";
 #else
-      dirname = (char *) ".";
+	  dirname = (char *) ".";
 #endif
-      dirlen = 0;
+	  dirlen = 0;
+	}
     }
   else if (filename == pattern)
     {
@@ -516,15 +528,16 @@ glob (pattern, flags, errfunc, pglob)
       dirname[dirlen] = '\0';
 #endif
       ++filename;
-    }
 
-  if (filename[0] == '\0' && dirlen > 1)
-    /* "pattern/".  Expand "pattern", appending slashes.  */
-    {
-      int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
-      if (val == 0)
-	pglob->gl_flags = (pglob->gl_flags & ~GLOB_MARK) | (flags & GLOB_MARK);
-      return val;
+      if (filename[0] == '\0' && dirlen > 1)
+	/* "pattern/".  Expand "pattern", appending slashes.  */
+	{
+	  int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
+	  if (val == 0)
+	    pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
+			       | (flags & GLOB_MARK));
+	  return val;
+	}
     }
 
   if (!(flags & GLOB_APPEND))