summaryrefslogtreecommitdiff
path: root/libc/misc/glob
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/glob')
-rw-r--r--libc/misc/glob/Makefile.in28
-rw-r--r--libc/misc/glob/glob-susv3.c27
-rw-r--r--libc/misc/glob/glob.c31
3 files changed, 15 insertions, 71 deletions
diff --git a/libc/misc/glob/Makefile.in b/libc/misc/glob/Makefile.in
index 93367f41b..c89d2b08d 100644
--- a/libc/misc/glob/Makefile.in
+++ b/libc/misc/glob/Makefile.in
@@ -1,31 +1,25 @@
# Makefile for uClibc
#
-# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-ifeq ($(UCLIBC_HAS_GNU_GLOB),y)
-CSRC := glob.c
-ifeq ($(UCLIBC_HAS_LFS),y)
-CSRC += glob64.c
-endif
-else
-CSRC := glob-susv3.c
-ifeq ($(UCLIBC_HAS_LFS),y)
-CSRC += glob64-susv3.c
-endif
-endif
+subdirs += libc/misc/glob
+
+VARIANT := $(if $(UCLIBC_HAS_GNU_GLOB),,-susv3)
+CSRC-y := glob$(VARIANT).c
+CSRC-$(UCLIBC_HAS_LFS) += glob64$(VARIANT).c
MISC_GLOB_DIR := $(top_srcdir)libc/misc/glob
MISC_GLOB_OUT := $(top_builddir)libc/misc/glob
-MISC_GLOB_SRC := $(patsubst %.c,$(MISC_GLOB_DIR)/%.c,$(CSRC))
-MISC_GLOB_OBJ := $(patsubst %.c,$(MISC_GLOB_OUT)/%.o,$(CSRC))
+MISC_GLOB_SRC := $(patsubst %.c,$(MISC_GLOB_DIR)/%.c,$(CSRC-y))
+MISC_GLOB_OBJ := $(patsubst %.c,$(MISC_GLOB_OUT)/%.o,$(CSRC-y))
libc-$(UCLIBC_HAS_GLOB) += $(MISC_GLOB_OBJ)
-objclean-y += misc_glob_objclean
+objclean-y += CLEAN_libc/misc/glob
-misc_glob_objclean:
- $(RM) $(MISC_GLOB_OUT)/*.{o,os}
+CLEAN_libc/misc/glob:
+ $(do_rm) $(addprefix $(MISC_GLOB_OUT)/*., o os)
diff --git a/libc/misc/glob/glob-susv3.c b/libc/misc/glob/glob-susv3.c
index 00963c36e..59b4d8e5f 100644
--- a/libc/misc/glob/glob-susv3.c
+++ b/libc/misc/glob/glob-susv3.c
@@ -23,16 +23,6 @@
#include <unistd.h>
#include <stdio.h>
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* Experimentally off - libc_hidden_proto(strcat) */
-/* Experimentally off - libc_hidden_proto(strchr) */
-/* Experimentally off - libc_hidden_proto(strcmp) */
-/* Experimentally off - libc_hidden_proto(strcpy) */
-/* Experimentally off - libc_hidden_proto(strlen) */
-libc_hidden_proto(opendir)
-libc_hidden_proto(closedir)
-libc_hidden_proto(qsort)
-libc_hidden_proto(fnmatch)
struct match
{
@@ -53,12 +43,8 @@ extern int __glob_match_in_dir(const char *d, const char *p, int flags, int (*er
# define stat stat64
# define readdir_r readdir64_r
# define dirent dirent64
-libc_hidden_proto(readdir64_r)
-libc_hidden_proto(stat64)
# define struct_stat struct stat64
#else
-libc_hidden_proto(readdir_r)
-libc_hidden_proto(stat)
# define struct_stat struct stat
#endif
@@ -197,7 +183,8 @@ int __glob_match_in_dir(const char *d, const char *p, int flags, int (*errfunc)(
# ifndef BUILD_GLOB64
static
# endif
-int __glob_ignore_err(const char *path, int err)
+int __glob_ignore_err(const char * path attribute_unused,
+ int err attribute_unused)
{
return 0;
}
@@ -223,11 +210,6 @@ int __glob_sort(const void *a, const void *b)
}
#endif /* !__GLOB64 */
-#ifdef __GLOB64
-libc_hidden_proto(glob64)
-#else
-libc_hidden_proto(glob)
-#endif
int glob(const char *pat, int flags, int (*errfunc)(const char *path, int err), glob_t *g)
{
const char *p=pat, *d;
@@ -301,11 +283,6 @@ libc_hidden_def(glob64)
libc_hidden_def(glob)
#endif
-#ifdef __GLOB64
-libc_hidden_proto(globfree64)
-#else
-libc_hidden_proto(globfree)
-#endif
void globfree(glob_t *g)
{
size_t i;
diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c
index 6ccbda4d7..923c03538 100644
--- a/libc/misc/glob/glob.c
+++ b/libc/misc/glob/glob.c
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#undef ENABLE_GLOB_BRACE_EXPANSION
#undef ENABLE_GLOB_TILDE_EXPANSION
@@ -31,24 +30,10 @@
#include <fnmatch.h>
#include <glob.h>
-libc_hidden_proto(closedir)
-libc_hidden_proto(fnmatch)
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* Experimentally off - libc_hidden_proto(mempcpy) */
-libc_hidden_proto(opendir)
-libc_hidden_proto(qsort)
-libc_hidden_proto(readdir)
-/* Experimentally off - libc_hidden_proto(strchr) */
-/* Experimentally off - libc_hidden_proto(strcoll) */
-/* Experimentally off - libc_hidden_proto(strcpy) */
-/* Experimentally off - libc_hidden_proto(strdup) */
-/* Experimentally off - libc_hidden_proto(strlen) */
-/* Experimentally off - libc_hidden_proto(strrchr) */
#ifdef ENABLE_GLOB_TILDE_EXPANSION
#include <pwd.h>
-libc_hidden_proto(getpwnam_r)
#endif
#ifdef COMPILE_GLOB64
@@ -62,19 +47,15 @@ libc_hidden_proto(getpwnam_r)
#define glob_t glob64_t
#define glob(pattern, flags, errfunc, pglob) glob64 (pattern, flags, errfunc, pglob)
#define globfree(pglob) globfree64 (pglob)
-libc_hidden_proto(stat64)
-libc_hidden_proto(readdir64)
#else
#define __readdir readdir
#ifdef __UCLIBC_HAS_LFS__
#define __readdir64 readdir64
-libc_hidden_proto(readdir64)
#else
#define __readdir64 readdir
#endif
#define struct_stat64 struct stat
#define __stat64(fname, buf) stat (fname, buf)
-libc_hidden_proto(stat)
#endif
@@ -132,7 +113,6 @@ extern int __prefix_array (const char *dirname, char **array, size_t n) attribut
extern const char *__next_brace_sub (const char *cp, int flags) attribute_hidden;
#endif
-libc_hidden_proto(glob_pattern_p)
#ifndef COMPILE_GLOB64
/* Return nonzero if PATTERN contains any metacharacters.
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
@@ -488,13 +468,6 @@ static int glob_in_dir (const char *pattern, const char *directory, int flags,
return GLOB_NOSPACE;
}
-#ifdef COMPILE_GLOB64
-libc_hidden_proto(glob64)
-libc_hidden_proto(globfree64)
-#else
-libc_hidden_proto(glob)
-libc_hidden_proto(globfree)
-#endif
/* Do glob searching for PATTERN, placing results in PGLOB.
The bits defined above may be set in FLAGS.
If a directory cannot be opened or read and ERRFUNC is not nil,