maint: update copyright
[gnulib.git] / lib / glob.c
index 85419cc..fcdee0b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
-# include <config.h>
-#endif
-
 /* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
    optimizes away the pattern == NULL || pglob == NULL tests below.  */
-#define _GL_ARG_NONNULL(params)
+# define _GL_ARG_NONNULL(params)
+# include <config.h>
+#endif
 
 #include <glob.h>
 
@@ -66,7 +65,7 @@
 #endif
 
 /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
-   if the `d_type' member for `struct dirent' is available.
+   if the 'd_type' member for 'struct dirent' is available.
    HAVE_STRUCT_DIRENT_D_TYPE plays the same role in GNULIB.  */
 #if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE
 /* True if the directory entry D must be of type T.  */
@@ -86,7 +85,7 @@
 # define DIRENT_MIGHT_BE_DIR(d)         true
 #endif /* HAVE_D_TYPE */
 
-/* If the system has the `struct dirent64' type we use it internally.  */
+/* If the system has the 'struct dirent64' type we use it internally.  */
 #if defined _LIBC && !defined COMPILE_GLOB64
 # if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
 #  define CONVERT_D_INO(d64, d32)
 # define __stat64(fname, buf)   stat (fname, buf)
 # define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
 # define struct_stat64          struct stat
-# define __stat(fname, buf)     stat (fname, buf)
 # define __alloca               alloca
 # define __readdir              readdir
-# define __readdir64            readdir64
 # define __glob_pattern_p       glob_pattern_p
 #endif /* _LIBC */
 
 # define GET_LOGIN_NAME_MAX()   (-1)
 #endif
 \f
-static const char *next_brace_sub (const char *begin, int flags) __THROW;
+static const char *next_brace_sub (const char *begin, int flags) __THROWNL;
 
 #endif /* !defined _LIBC || !defined GLOB_ONLY_P */
 
@@ -213,8 +210,8 @@ extern int __glob_pattern_type (const char *pattern, int quote)
     attribute_hidden;
 
 #if !defined _LIBC || !defined GLOB_ONLY_P
-static int prefix_array (const char *prefix, char **array, size_t n) __THROW;
-static int collated_compare (const void *, const void *) __THROW;
+static int prefix_array (const char *prefix, char **array, size_t n) __THROWNL;
+static int collated_compare (const void *, const void *) __THROWNL;
 
 
 /* Find the end of the sub-pattern in a brace expression.  */
@@ -247,10 +244,10 @@ next_brace_sub (const char *cp, int flags)
    The bits defined above may be set in FLAGS.
    If a directory cannot be opened or read and ERRFUNC is not nil,
    it is called with the pathname that caused the error, and the
-   `errno' value from the failing call; if it returns non-zero
-   `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
+   'errno' value from the failing call; if it returns non-zero
+   'glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
-   Otherwise, `glob' returns zero.  */
+   Otherwise, 'glob' returns zero.  */
 int
 #ifdef GLOB_ATTRIBUTE
 GLOB_ATTRIBUTE
@@ -277,7 +274,7 @@ glob (pattern, flags, errfunc, pglob)
     }
 
   if (!(flags & GLOB_DOOFFS))
-    /* Have to do this so `globfree' knows where to start freeing.  It
+    /* Have to do this so 'globfree' knows where to start freeing.  It
        also makes all the code that uses gl_offs simpler. */
     pglob->gl_offs = 0;
 
@@ -430,7 +427,7 @@ 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
+  /* 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".  */
@@ -489,7 +486,7 @@ glob (pattern, flags, errfunc, pglob)
              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
+          /* 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.*/
         }
@@ -599,7 +596,7 @@ glob (pattern, flags, errfunc, pglob)
               size_t buflen = GET_LOGIN_NAME_MAX () + 1;
 
               if (buflen == 0)
-                /* `sysconf' does not support _SC_LOGIN_NAME_MAX.  Try
+                /* 'sysconf' does not support _SC_LOGIN_NAME_MAX.  Try
                    a moderate value.  */
                 buflen = 20;
               name = __alloca (buflen);
@@ -616,7 +613,7 @@ glob (pattern, flags, errfunc, pglob)
 
 #    ifndef _LIBC
                   if (pwbuflen == -1)
-                    /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
+                    /* 'sysconf' does not support _SC_GETPW_R_SIZE_MAX.
                        Try a moderate value.  */
                     pwbuflen = 1024;
 #    endif
@@ -741,7 +738,7 @@ glob (pattern, flags, errfunc, pglob)
 
 #   ifndef _LIBC
             if (buflen == -1)
-              /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.  Try a
+              /* 'sysconf' does not support _SC_GETPW_R_SIZE_MAX.  Try a
                  moderate value.  */
               buflen = 1024;
 #   endif
@@ -946,7 +943,7 @@ glob (pattern, flags, errfunc, pglob)
 
       flags |= GLOB_MAGCHAR;
 
-      /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls.
+      /* We have ignored the GLOB_NOCHECK flag in the 'glob_in_dir' calls.
          But if we have not found any matching entry and the GLOB_NOCHECK
          flag was set we must return the input pattern itself.  */
       if (pglob->gl_pathc + pglob->gl_offs == oldcount)
@@ -1091,7 +1088,7 @@ libc_hidden_def (glob)
 
 #if !defined _LIBC || !defined GLOB_ONLY_P
 
-/* Free storage allocated in PGLOB by a previous `glob' call.  */
+/* Free storage allocated in PGLOB by a previous 'glob' call.  */
 void
 globfree (pglob)
      register glob_t *pglob;
@@ -1156,7 +1153,7 @@ prefix_array (const char *dirname, char **array, size_t n)
         --dirlen;
       else if (dirname[dirlen - 1] == ':')
         {
-          /* DIRNAME is "d:".  Use `:' instead of `/'.  */
+          /* DIRNAME is "d:".  Use ':' instead of '/'.  */
           --dirlen;
           sep_char = ':';
         }
@@ -1294,7 +1291,7 @@ link_exists_p (int dfd, const char *dir, size_t dirlen, const char *fname,
 #endif
 
 
-/* Like `glob', but PATTERN is a final pathname component,
+/* Like 'glob', but PATTERN is a final pathname component,
    and matches are searched for in DIRECTORY.
    The GLOB_NOSORT bit in FLAGS is ignored.  No sorting is ever done.
    The GLOB_APPEND flag is assumed to be set (always appends).  */