Updated from libc
authorRoland McGrath <roland@redhat.com>
Sat, 22 Jun 1996 21:14:22 +0000 (21:14 +0000)
committerRoland McGrath <roland@redhat.com>
Sat, 22 Jun 1996 21:14:22 +0000 (21:14 +0000)
glob/ChangeLog
glob/fnmatch.c
glob/glob.c
glob/glob.h

index 33c1656..686f07b 100644 (file)
@@ -1,5 +1,22 @@
+Sat Jun 22 10:44:09 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
+
+       * posix/glob.c: Include <alloca.h> only [HAVE_ALLOCA_H], not [sparc].
+
+Fri Jun 21 00:27:51 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
+
+       * posix/fnmatch.c (fnmatch): Fix \*[*?]+ case to increment name ptr
+       only for ?s, not for *s.  Fix from Chet Ramey.
+
+Wed May 22 17:22:14 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
+
+       * posix/glob.c [VMS]: Don't include <pwd.h>.
+       [HAVE_VMSDIR_H]: Include "vmsdir.h".
+       (glob) [VMS]: Don't grok ~.
+
 Mon May 13 12:03:03 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
 
+       * posix/glob.h [_AMIGA]: Remove `struct stat;' forward decl.
+
        * posix/glob.c [_AMIGA]: Don't include <pwd.h>.
        (glob): Remove bogus & in call to globfree.
        [_AMIGA]: Use AmigaDOS file name conventions.
index 08c1c94..de45941 100644 (file)
@@ -92,10 +92,24 @@ fnmatch (pattern, string, flags)
              (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
            return FNM_NOMATCH;
 
-         for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
-           if (((flags & FNM_FILE_NAME) && *n == '/') ||
-               (c == '?' && *n == '\0'))
-             return FNM_NOMATCH;
+         for (c = *p++; c == '?' || c == '*'; c = *p++)
+           {
+             if ((flags & FNM_FILE_NAME) && *n == '/')
+               /* A slash does not match a wildcard under FNM_FILE_NAME.  */
+               return FNM_NOMATCH;
+             else if (c == '?')
+               {
+                 /* A ? needs to match one character.  */
+                 if (*n == '\0')
+                   /* There isn't another character; no match.  */
+                   return FNM_NOMATCH;
+                 else
+                   /* One character of the string is consumed in matching
+                      this ? wildcard, so *??? won't match if there are
+                      less than three characters.  */
+                   ++n;
+               }
+           }
 
          if (c == '\0')
            return 0;
index 7dfd7f5..d6635fc 100644 (file)
@@ -65,7 +65,7 @@ Cambridge, MA 02139, USA.  */
 #endif
 #endif
 
-#ifndef _AMIGA
+#if !defined (_AMIGA) && !defined (VMS)
 #include <pwd.h>
 #endif
 
@@ -93,6 +93,9 @@ extern int errno;
 # ifdef HAVE_NDIR_H
 #  include <ndir.h>
 # endif
+# ifdef HAVE_VMSDIR_H
+#  include "vmsdir.h"
+# endif /* HAVE_VMSDIR_H */
 #endif
 
 
@@ -185,9 +188,9 @@ my_realloc (p, n)
 #undef alloca
 #define        alloca(n)       __builtin_alloca (n)
 #else  /* Not GCC.  */
-#if    defined (sparc) || defined (HAVE_ALLOCA_H)
+#ifdef HAVE_ALLOCA_H
 #include <alloca.h>
-#else  /* Not sparc or HAVE_ALLOCA_H.  */
+#else  /* Not HAVE_ALLOCA_H.  */
 #ifndef        _AIX
 extern char *alloca ();
 #endif /* Not _AIX.  */
@@ -435,6 +438,7 @@ glob (pattern, flags, errfunc, pglob)
 
   oldcount = pglob->gl_pathc;
 
+#ifndef VMS
   if ((flags & GLOB_TILDE) && dirname[0] == '~')
     {
       if (dirname[1] == '\0')
@@ -473,6 +477,7 @@ glob (pattern, flags, errfunc, pglob)
 #endif
        }
     }
+#endif /* Not VMS.  */
 
   if (glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
     {
index 6eea062..73fd018 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public License as
@@ -65,7 +65,9 @@ extern "C"
 #define        GLOB_NOMATCH    3       /* No matches found.  */
 
 /* Structure describing a globbing run.  */
+#ifndef _AMIGA                 /* Buggy compiler.   */
 struct stat;
+#endif
 typedef struct
   {
     int gl_pathc;              /* Count of paths matched by the pattern.  */