* glob.c (collated_compare): Remove 'const' uses that weren't needed.
[pspp] / lib / glob.c
index 7499c5bfd1e946fe263f5535a55d9029d0e6cd87..28ca8a06b09d75d54856966e187b11b90546a3c3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include <stdio.h>             /* Needed on stupid SunOS for assert.  */
 
 #if !defined _LIBC || !defined GLOB_ONLY_P
-#if defined HAVE_UNISTD_H || defined _LIBC
-# include <unistd.h>
-# ifndef POSIX
-#  ifdef _POSIX_VERSION
-#   define POSIX
-#  endif
-# endif
+
+#include <unistd.h>
+#if !defined POSIX && defined _POSIX_VERSION
+# define POSIX
 #endif
 
 #include <pwd.h>
 # define GETPW_R_SIZE_MAX()    (-1)
 #endif
 #ifdef _SC_LOGIN_NAME_MAX
-# define LOGIN_NAME_MAX()      sysconf (_SC_LOGIN_NAME_MAX)
+# define GET_LOGIN_NAME_MAX()  sysconf (_SC_LOGIN_NAME_MAX)
 #else
-# define LOGIN_NAME_MAX()      (-1)
+# define GET_LOGIN_NAME_MAX()  (-1)
 #endif
 \f
 static const char *next_brace_sub (const char *begin, int flags) __THROW;
@@ -240,9 +237,11 @@ int
 #ifdef GLOB_ATTRIBUTE
 GLOB_ATTRIBUTE
 #endif
-glob (const char *pattern, int flags,
-      int (*errfunc) (const char *, int),
-      glob_t *pglob)
+glob (pattern, flags, errfunc, pglob)
+     const char *pattern;
+     int flags;
+     int (*errfunc) (const char *, int);
+     glob_t *pglob;
 {
   const char *filename;
   const char *dirname;
@@ -320,7 +319,7 @@ glob (const char *pattern, int flags,
          next = next_brace_sub (begin + 1, flags);
          if (next == NULL)
            {
-             /* It is an illegal expression.  */
+             /* It is an invalid expression.  */
 #ifndef __GNUC__
              free (onealt);
 #endif
@@ -334,7 +333,7 @@ glob (const char *pattern, int flags,
              rest = next_brace_sub (rest + 1, flags);
              if (rest == NULL)
                {
-                 /* It is an illegal expression.  */
+                 /* It is an invalid expression.  */
 #ifndef __GNUC__
                  free (onealt);
 #endif
@@ -531,7 +530,7 @@ glob (const char *pattern, int flags,
            {
              int success;
              char *name;
-             size_t buflen = LOGIN_NAME_MAX() + 1;
+             size_t buflen = GET_LOGIN_NAME_MAX () + 1;
 
              if (buflen == 0)
                /* `sysconf' does not support _SC_LOGIN_NAME_MAX.  Try
@@ -888,7 +887,8 @@ libc_hidden_def (glob)
 
 /* Free storage allocated in PGLOB by a previous `glob' call.  */
 void
-globfree (register glob_t *pglob)
+globfree (pglob)
+     register glob_t *pglob;
 {
   if (pglob->gl_pathv != NULL)
     {
@@ -909,8 +909,8 @@ libc_hidden_def (globfree)
 static int
 collated_compare (const void *a, const void *b)
 {
-  const char *const s1 = *(const char *const * const) a;
-  const char *const s2 = *(const char *const * const) b;
+  char *const *ps1 = a; char *s1 = *ps1;
+  char *const *ps2 = b; char *s2 = *ps2;
 
   if (s1 == s2)
     return 0;
@@ -986,7 +986,9 @@ prefix_array (const char *dirname, char **array, size_t n)
 /* Return nonzero if PATTERN contains any metacharacters.
    Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
 int
-__glob_pattern_p (const char *pattern, int quote)
+__glob_pattern_p (pattern, quote)
+     const char *pattern;
+     int quote;
 {
   register const char *p;
   int open = 0;