1 /* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
3 This library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Library General Public License as
5 published by the Free Software Foundation; either version 2 of the
6 License, or (at your option) any later version.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public
14 License along with this library; see the file COPYING.LIB. If not,
15 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. */
18 /* AIX requires this to be the first thing in the file. */
19 #if defined _AIX && !defined __GNUC__
27 /* Enable GNU extensions in glob.h. */
29 # define _GNU_SOURCE 1
33 #include <sys/types.h>
36 /* Outcomment the following line for production quality code. */
37 /* #define NDEBUG 1 */
40 #include <stdio.h> /* Needed on stupid SunOS for assert. */
43 /* Comment out all this code if we are using the GNU C Library, and are not
44 actually compiling the library itself. This code is part of the GNU C
45 Library, but also included in many other GNU distributions. Compiling
46 and linking in this code is a waste when using the GNU C library
47 (especially if it is a shared library). Rather than having every GNU
48 program understand `configure --with-gnu-libc' and omit the object files,
49 it is simpler to just do this in the source for each such file. */
51 #define GLOB_INTERFACE_VERSION 1
52 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
53 # include <gnu-versions.h>
54 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
61 #if defined STDC_HEADERS || defined __GNU_LIBRARY__
65 #if defined HAVE_UNISTD_H || defined _LIBC
68 # ifdef _POSIX_VERSION
74 #if !defined _AMIGA && !defined VMS && !defined WINDOWS32
78 #if !defined __GNU_LIBRARY__ && !defined STDC_HEADERS
82 # define __set_errno(val) errno = (val)
90 #if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
92 # define NAMLEN(dirent) strlen((dirent)->d_name)
94 # define dirent direct
95 # define NAMLEN(dirent) (dirent)->d_namlen
96 # ifdef HAVE_SYS_NDIR_H
97 # include <sys/ndir.h>
99 # ifdef HAVE_SYS_DIR_H
100 # include <sys/dir.h>
105 # ifdef HAVE_VMSDIR_H
107 # endif /* HAVE_VMSDIR_H */
111 /* In GNU systems, <dirent.h> defines this macro for us. */
114 # define NAMLEN(d) _D_NAMLEN(d)
117 /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
118 if the `d_type' member for `struct dirent' is available. */
119 #ifdef _DIRENT_HAVE_D_TYPE
120 # define HAVE_D_TYPE 1
124 #if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
125 /* Posix does not require that the d_ino field be present, and some
126 systems do not provide it. */
127 # define REAL_DIR_ENTRY(dp) 1
129 # define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
132 #if defined STDC_HEADERS || defined __GNU_LIBRARY__
136 #else /* No standard headers. */
138 extern char *getenv ();
140 # ifdef HAVE_STRING_H
144 # include <strings.h>
146 # ifdef HAVE_MEMORY_H
150 extern char *malloc (), *realloc ();
153 extern void qsort ();
154 extern void abort (), exit ();
156 #endif /* Standard headers. */
161 extern void bzero ();
164 extern void bcopy ();
167 # define memcpy(d, s, n) bcopy ((s), (d), (n))
168 # define strrchr rindex
169 /* memset is only used for zero here, but let's be paranoid. */
170 # define memset(s, better_be_zero, n) \
171 ((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
172 #endif /* Not ANSI_STRING. */
174 #if !defined HAVE_STRCOLL && !defined _LIBC
175 # define strcoll strcmp
178 #if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1
179 # define HAVE_MEMPCPY 1
180 # define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
184 #ifndef __GNU_LIBRARY__
198 /* These casts are the for sake of the broken Ultrix compiler,
199 which warns of illegal pointer combinations otherwise. */
201 return (char *) malloc (n);
202 return (char *) realloc (p, n);
204 # define realloc my_realloc
206 #endif /* __GNU_LIBRARY__ */
209 #if !defined __alloca && !defined __GNU_LIBRARY__
213 # define alloca(n) __builtin_alloca (n)
214 # else /* Not GCC. */
215 # ifdef HAVE_ALLOCA_H
217 # else /* Not HAVE_ALLOCA_H. */
222 extern char *alloca ();
223 # endif /* WINDOWS32 */
224 # endif /* Not _AIX. */
225 # endif /* sparc or HAVE_ALLOCA_H. */
228 # define __alloca alloca
232 #ifndef __GNU_LIBRARY__
234 # ifdef STAT_MACROS_BROKEN
238 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
242 #if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
244 # define size_t unsigned int
247 /* Some system header files erroneously define these.
248 We want our own definitions from <fnmatch.h> to take precedence. */
254 /* Some system header files erroneously define these.
255 We want our own definitions from <glob.h> to take precedence. */
267 #if __GNUC__ - 0 >= 2
270 const char *next_brace_sub __P ((const char *begin));
271 static int glob_in_dir __P ((const char *pattern, const char *directory,
273 int (*errfunc) __P ((const char *, int)),
275 static int prefix_array __P ((const char *prefix, char **array, size_t n));
276 static int collated_compare __P ((const __ptr_t, const __ptr_t));
279 /* Find the end of the sub-pattern in a brace expression. We define
280 this as an inline function if the compiler permits. */
282 #if __GNUC__ - 0 >= 2
286 next_brace_sub (begin)
289 unsigned int depth = 0;
290 const char *cp = begin;
296 if (*cp != ',' && *cp != '}' && *cp != '\0')
306 while (*cp != '\0' && (*cp != '}' || depth > 0))
313 /* An incorrectly terminated brace expression. */
324 /* Do glob searching for PATTERN, placing results in PGLOB.
325 The bits defined above may be set in FLAGS.
326 If a directory cannot be opened or read and ERRFUNC is not nil,
327 it is called with the pathname that caused the error, and the
328 `errno' value from the failing call; if it returns non-zero
329 `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
330 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
331 Otherwise, `glob' returns zero. */
333 glob (pattern, flags, errfunc, pglob)
336 int (*errfunc) __P ((const char *, int));
339 const char *filename;
345 if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
347 __set_errno (EINVAL);
351 if (flags & GLOB_BRACE)
353 const char *begin = strchr (pattern, '{');
356 /* Allocate working buffer large enough for our work. Note that
357 we have at least an opening and closing brace. */
365 char onealt[strlen (pattern) - 1];
367 char *onealt = (char *) malloc (strlen (pattern) - 1);
370 if (!(flags & GLOB_APPEND))
376 /* We know the prefix for all sub-patterns. */
377 memcpy (onealt, pattern, begin - pattern);
378 alt_start = &onealt[begin - pattern];
380 /* Find the first sub-pattern and at the same time find the
381 rest after the closing brace. */
382 next = next_brace_sub (begin + 1);
385 /* It is an illegal expression. */
389 return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
392 /* Now find the end of the whole brace expression. */
396 rest = next_brace_sub (rest + 1);
399 /* It is an illegal expression. */
403 return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
406 /* Please note that we now can be sure the brace expression
408 rest_len = strlen (++rest) + 1;
410 /* We have a brace expression. BEGIN points to the opening {,
411 NEXT points past the terminator of the first element, and END
412 points past the final }. We will accumulate result names from
413 recursive runs for each brace alternative in the buffer using
416 if (!(flags & GLOB_APPEND))
418 /* This call is to set a new vector, so clear out the
419 vector so we can append to it. */
421 pglob->gl_pathv = NULL;
423 firstc = pglob->gl_pathc;
430 /* Construct the new glob expression. */
432 mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len);
434 memcpy (alt_start, p, next - p);
435 memcpy (&alt_start[next - p], rest, rest_len);
438 result = glob (onealt,
439 ((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC))
440 | GLOB_APPEND), errfunc, pglob);
442 /* If we got an error, return it. */
443 if (result && result != GLOB_NOMATCH)
448 if (!(flags & GLOB_APPEND))
454 /* We saw the last entry. */
458 next = next_brace_sub (p);
459 assert (next != NULL);
466 if (pglob->gl_pathc != firstc)
467 /* We found some entries. */
469 else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
474 /* Find the filename. */
475 filename = strrchr (pattern, '/');
476 if (filename == NULL)
480 dirname = (char *) "";
482 dirname = (char *) ".";
486 else if (filename == pattern)
489 dirname = (char *) "/";
495 dirlen = filename - pattern;
496 dirname = (char *) __alloca (dirlen + 1);
498 *((char *) mempcpy (dirname, pattern, dirlen)) = '\0';
500 memcpy (dirname, pattern, dirlen);
501 dirname[dirlen] = '\0';
506 if (filename[0] == '\0' && dirlen > 1)
507 /* "pattern/". Expand "pattern", appending slashes. */
509 int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
511 pglob->gl_flags = (pglob->gl_flags & ~GLOB_MARK) | (flags & GLOB_MARK);
515 if (!(flags & GLOB_APPEND))
518 pglob->gl_pathv = NULL;
521 oldcount = pglob->gl_pathc;
524 if ((flags & GLOB_TILDE) && dirname[0] == '~')
526 if (dirname[1] == '\0' || dirname[1] == '/')
528 /* Look up home directory. */
529 char *home_dir = getenv ("HOME");
531 if (home_dir == NULL || home_dir[0] == '\0')
535 if (home_dir == NULL || home_dir[0] == '\0')
536 home_dir = "c:/users/default"; /* poor default */
538 if (home_dir == NULL || home_dir[0] == '\0')
541 # if defined HAVE_GETLOGIN_R || defined _LIBC
542 extern int getlogin_r __P ((char *, size_t));
543 size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
547 /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try
550 name = (char *) __alloca (buflen);
552 success = getlogin_r (name, buflen) >= 0;
554 extern char *getlogin __P ((void));
557 success = (name = getlogin ()) != NULL;
561 # if defined HAVE_GETPWNAM_R || defined _LIBC
562 size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
564 struct passwd pwbuf, *p;
566 pwtmpbuf = (char *) __alloca (pwbuflen);
568 success = (__getpwnam_r (name, &pwbuf, pwtmpbuf,
571 struct passwd *p = getpwnam (name);
575 home_dir = p->pw_dir;
578 if (home_dir == NULL || home_dir[0] == '\0')
579 home_dir = (char *) "~"; /* No luck. */
580 # endif /* WINDOWS32 */
582 /* Now construct the full directory. */
583 if (dirname[1] == '\0')
588 size_t home_len = strlen (home_dir);
589 newp = (char *) __alloca (home_len + dirlen);
591 mempcpy (mempcpy (newp, home_dir, home_len),
592 &dirname[1], dirlen);
594 memcpy (newp, home_dir, home_len);
595 memcpy (&newp[home_len], &dirname[1], dirlen);
600 # if !defined _AMIGA && !defined WINDOWS32
603 char *end_name = strchr (dirname, '/');
607 if (end_name == NULL)
608 user_name = dirname + 1;
611 user_name = (char *) __alloca (end_name - dirname);
613 *((char *) mempcpy (user_name, dirname + 1, end_name - dirname))
616 memcpy (user_name, dirname + 1, end_name - dirname);
617 user_name[end_name - dirname - 1] = '\0';
621 /* Look up specific user's home directory. */
623 # if defined HAVE_GETPWNAM_R || defined _LIBC
624 size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
625 char *pwtmpbuf = (char *) __alloca (buflen);
626 struct passwd pwbuf, *p;
627 if (__getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0)
628 home_dir = p->pw_dir;
632 struct passwd *p = getpwnam (user_name);
634 home_dir = p->pw_dir;
639 /* If we found a home directory use this. */
640 if (home_dir != NULL)
643 size_t home_len = strlen (home_dir);
644 size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
645 newp = (char *) __alloca (home_len + rest_len + 1);
647 *((char *) mempcpy (mempcpy (newp, home_dir, home_len),
648 end_name, rest_len)) = '\0';
650 memcpy (newp, home_dir, home_len);
651 memcpy (&newp[home_len], end_name, rest_len);
652 newp[home_len + rest_len] = '\0';
657 # endif /* Not Amiga && not WINDOWS32. */
659 #endif /* Not VMS. */
661 if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
663 /* The directory name contains metacharacters, so we
664 have to glob for the directory, and then glob for
665 the pattern in each directory found. */
669 status = glob (dirname,
670 ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE))
671 | GLOB_NOSORT | GLOB_ONLYDIR),
676 /* We have successfully globbed the preceding directory name.
677 For each name we found, call glob_in_dir on it and FILENAME,
678 appending the results to PGLOB. */
679 for (i = 0; i < dirs.gl_pathc; ++i)
685 /* Make globbing interruptible in the bash shell. */
686 extern int interrupt_state;
697 oldcount = pglob->gl_pathc;
698 status = glob_in_dir (filename, dirs.gl_pathv[i],
699 ((flags | GLOB_APPEND)
700 & ~(GLOB_NOCHECK | GLOB_ERR)),
702 if (status == GLOB_NOMATCH)
703 /* No matches in this directory. Try the next. */
713 /* Stick the directory on the front of each name. */
714 if (prefix_array (dirs.gl_pathv[i],
715 &pglob->gl_pathv[oldcount],
716 pglob->gl_pathc - oldcount))
724 flags |= GLOB_MAGCHAR;
726 if (pglob->gl_pathc == oldcount)
728 if (flags & GLOB_NOCHECK)
730 size_t len = strlen (pattern) + 1;
731 char *patcopy = (char *) malloc (len);
734 memcpy (patcopy, pattern, len);
737 = (char **) realloc (pglob->gl_pathv,
739 ((flags & GLOB_DOOFFS) ?
740 pglob->gl_offs : 0) +
743 if (pglob->gl_pathv == NULL)
749 if (flags & GLOB_DOOFFS)
750 while (pglob->gl_pathc < pglob->gl_offs)
751 pglob->gl_pathv[pglob->gl_pathc++] = NULL;
753 pglob->gl_pathv[pglob->gl_pathc++] = patcopy;
754 pglob->gl_pathv[pglob->gl_pathc] = NULL;
755 pglob->gl_flags = flags;
762 status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
768 /* Stick the directory on the front of each name. */
769 if (prefix_array (dirname,
770 &pglob->gl_pathv[oldcount],
771 pglob->gl_pathc - oldcount))
779 if (flags & GLOB_MARK)
781 /* Append slashes to directory names. */
784 for (i = oldcount; i < pglob->gl_pathc; ++i)
785 if (((flags & GLOB_ALTDIRFUNC) ?
786 (*pglob->gl_stat) (pglob->gl_pathv[i], &st) :
787 __stat (pglob->gl_pathv[i], &st)) == 0 &&
788 S_ISDIR (st.st_mode))
790 size_t len = strlen (pglob->gl_pathv[i]) + 2;
791 char *new = realloc (pglob->gl_pathv[i], len);
797 strcpy (&new[len - 2], "/");
798 pglob->gl_pathv[i] = new;
802 if (!(flags & GLOB_NOSORT))
803 /* Sort the vector. */
804 qsort ((__ptr_t) &pglob->gl_pathv[oldcount],
805 pglob->gl_pathc - oldcount,
806 sizeof (char *), collated_compare);
812 /* Free storage allocated in PGLOB by a previous `glob' call. */
815 register glob_t *pglob;
817 if (pglob->gl_pathv != NULL)
820 for (i = 0; i < pglob->gl_pathc; ++i)
821 if (pglob->gl_pathv[i] != NULL)
822 free ((__ptr_t) pglob->gl_pathv[i]);
823 free ((__ptr_t) pglob->gl_pathv);
828 /* Do a collated comparison of A and B. */
830 collated_compare (a, b)
834 const char *const s1 = *(const char *const * const) a;
835 const char *const s2 = *(const char *const * const) b;
843 return strcoll (s1, s2);
847 /* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's
848 elements in place. Return nonzero if out of memory, zero if successful.
849 A slash is inserted between DIRNAME and each elt of ARRAY,
850 unless DIRNAME is just "/". Each old element of ARRAY is freed. */
852 prefix_array (dirname, array, n)
858 size_t dirlen = strlen (dirname);
860 if (dirlen == 1 && dirname[0] == '/')
861 /* DIRNAME is just "/", so normal prepending would get us "//foo".
862 We want "/foo" instead, so don't prepend any chars from DIRNAME. */
865 for (i = 0; i < n; ++i)
867 size_t eltlen = strlen (array[i]) + 1;
868 char *new = (char *) malloc (dirlen + 1 + eltlen);
872 free ((__ptr_t) array[--i]);
878 char *endp = (char *) mempcpy (new, dirname, dirlen);
880 mempcpy (endp, array[i], eltlen);
883 memcpy (new, dirname, dirlen);
885 memcpy (&new[dirlen + 1], array[i], eltlen);
887 free ((__ptr_t) array[i]);
895 /* Return nonzero if PATTERN contains any metacharacters.
896 Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
898 __glob_pattern_p (pattern, quote)
902 register const char *p;
905 for (p = pattern; *p != '\0'; ++p)
913 if (quote && p[1] != '\0')
930 weak_alias (__glob_pattern_p, glob_pattern_p)
934 /* Like `glob', but PATTERN is a final pathname component,
935 and matches are searched for in DIRECTORY.
936 The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
937 The GLOB_APPEND flag is assumed to be set (always appends). */
939 glob_in_dir (pattern, directory, flags, errfunc, pglob)
941 const char *directory;
943 int (*errfunc) __P ((const char *, int));
950 struct globlink *next;
953 struct globlink *names = NULL;
956 if (!__glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
958 /* We must check whether the file in this directory exists. */
959 stream = ((flags & GLOB_ALTDIRFUNC) ?
960 (*pglob->gl_opendir) (directory) :
961 (__ptr_t) opendir (directory));
964 if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
968 else if (pattern[0] == '\0')
970 /* This is a special case for matching directories like in
972 names = (struct globlink *) __alloca (sizeof (struct globlink));
973 names->name = (char *) malloc (1);
974 if (names->name == NULL)
976 names->name[0] = '\0';
983 struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
984 (*pglob->gl_readdir) (stream) :
985 readdir ((DIR *) stream));
988 if (! REAL_DIR_ENTRY (d))
992 /* If we shall match only directories use the information
993 provided by the dirent if possible. */
994 if ((flags & GLOB_ONLYDIR)
995 && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
999 if (strcmp (pattern, d->d_name) == 0)
1001 size_t len = NAMLEN (d);
1003 (struct globlink *) __alloca (sizeof (struct globlink));
1004 names->name = (char *) malloc (len + 1);
1005 if (names->name == NULL)
1008 *((char *) mempcpy ((__ptr_t) names->name, pattern, len))
1011 memcpy ((__ptr_t) names->name, pattern, len);
1012 names->name[len] = '\0';
1022 flags |= GLOB_MAGCHAR;
1024 stream = ((flags & GLOB_ALTDIRFUNC) ?
1025 (*pglob->gl_opendir) (directory) :
1026 (__ptr_t) opendir (directory));
1029 if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
1031 return GLOB_ABORTED;
1038 struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
1039 (*pglob->gl_readdir) (stream) :
1040 readdir ((DIR *) stream));
1043 if (! REAL_DIR_ENTRY (d))
1049 /* If we shall match only directories use the information
1050 provided by the dirent if possible. */
1051 if ((flags & GLOB_ONLYDIR)
1052 && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
1056 if (fnmatch (pattern, name,
1057 (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
1058 ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
1064 struct globlink *new
1065 = (struct globlink *) __alloca (sizeof (struct globlink));
1068 = (char *) malloc (len + 1);
1069 if (new->name == NULL)
1072 *((char *) mempcpy ((__ptr_t) new->name, name, len)) = '\0';
1074 memcpy ((__ptr_t) new->name, name, len);
1075 new->name[len] = '\0';
1084 if (nfound == 0 && (flags & GLOB_NOMAGIC) &&
1085 ! __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
1086 flags |= GLOB_NOCHECK;
1088 if (nfound == 0 && (flags & GLOB_NOCHECK))
1090 size_t len = strlen (pattern);
1092 names = (struct globlink *) __alloca (sizeof (struct globlink));
1094 names->name = (char *) malloc (len + 1);
1095 if (names->name == NULL)
1098 *((char *) mempcpy (names->name, pattern, len)) = '\0';
1100 memcpy (names->name, pattern, len);
1101 names->name[len] = '\0';
1108 = (char **) realloc (pglob->gl_pathv,
1110 ((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) +
1113 if (pglob->gl_pathv == NULL)
1116 if (flags & GLOB_DOOFFS)
1117 while (pglob->gl_pathc < pglob->gl_offs)
1118 pglob->gl_pathv[pglob->gl_pathc++] = NULL;
1120 for (; names != NULL; names = names->next)
1121 pglob->gl_pathv[pglob->gl_pathc++] = names->name;
1122 pglob->gl_pathv[pglob->gl_pathc] = NULL;
1124 pglob->gl_flags = flags;
1130 if (flags & GLOB_ALTDIRFUNC)
1131 (*pglob->gl_closedir) (stream);
1133 closedir ((DIR *) stream);
1136 return nfound == 0 ? GLOB_NOMATCH : 0;
1141 if (flags & GLOB_ALTDIRFUNC)
1142 (*pglob->gl_closedir) (stream);
1144 closedir ((DIR *) stream);
1147 while (names != NULL)
1149 if (names->name != NULL)
1150 free ((__ptr_t) names->name);
1151 names = names->next;
1153 return GLOB_NOSPACE;
1156 #endif /* Not ELIDE_CODE. */