summaryrefslogtreecommitdiff
path: root/libc/misc/glob
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-03-31 04:42:13 +0000
committerEric Andersen <andersen@codepoet.org>2002-03-31 04:42:13 +0000
commit367660c192983fb223b89985d415fb0e62f4b4ba (patch)
tree57a34b2cb4746b7a1e265000708dabf426e5aa0a /libc/misc/glob
parentcdb29e3ea6c22f0c0358f0414e3ddb615b1c394f (diff)
Add glob64.c, and add support for glob64 when large file is enabled.
-Erik
Diffstat (limited to 'libc/misc/glob')
-rw-r--r--libc/misc/glob/Makefile4
-rw-r--r--libc/misc/glob/glob-hooks.c35
-rw-r--r--libc/misc/glob/glob64.c33
3 files changed, 71 insertions, 1 deletions
diff --git a/libc/misc/glob/Makefile b/libc/misc/glob/Makefile
index e4ecd078a..e53c95b18 100644
--- a/libc/misc/glob/Makefile
+++ b/libc/misc/glob/Makefile
@@ -24,7 +24,7 @@
TOPDIR=../../../
include $(TOPDIR)Rules.mak
-CSRC=glob.c
+CSRC=glob.c glob64.c glob-hooks.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS)
@@ -39,6 +39,8 @@ $(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
+glob64.o: glob64.c glob.c
+
clean:
rm -f *.[oa] *~ core
diff --git a/libc/misc/glob/glob-hooks.c b/libc/misc/glob/glob-hooks.c
new file mode 100644
index 000000000..e2d8030cf
--- /dev/null
+++ b/libc/misc/glob/glob-hooks.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+ *
+ * modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <malloc.h>
+#include <fnmatch.h>
+#include <glob.h>
+
+
+__ptr_t (*__glob_opendir_hook) __P ((const char *directory));
+const char *(*__glob_readdir_hook) __P ((__ptr_t stream));
+void (*__glob_closedir_hook) __P ((__ptr_t stream));
+
diff --git a/libc/misc/glob/glob64.c b/libc/misc/glob/glob64.c
new file mode 100644
index 000000000..83a406afd
--- /dev/null
+++ b/libc/misc/glob/glob64.c
@@ -0,0 +1,33 @@
+#include <features.h>
+
+#ifdef __UCLIBC_HAVE_LFS__
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
+#undef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#endif
+#ifndef __USE_FILE_OFFSET64
+# define __USE_FILE_OFFSET64 1
+#endif
+#ifndef __USE_LARGEFILE64
+# define __USE_LARGEFILE64 1
+#endif
+#include <dirent.h>
+#include <glob.h>
+#include <sys/stat.h>
+
+#define dirent dirent64
+#define readdir(dirp) readdir64 (dirp)
+
+#define glob_t glob64_t
+#define glob(pattern, flags, errfunc, pglob) \
+ glob64 (pattern, flags, errfunc, pglob)
+#define globfree(pglob) globfree64 (pglob)
+
+#undef stat
+#define stat stat64
+#define lstat lstat64
+
+#include "glob.c"
+
+#endif