Browse Source

Add glob64.c, and add support for glob64 when large file is enabled.
-Erik

Eric Andersen 22 years ago
parent
commit
367660c192
3 changed files with 71 additions and 1 deletions
  1. 3 1
      libc/misc/glob/Makefile
  2. 35 0
      libc/misc/glob/glob-hooks.c
  3. 33 0
      libc/misc/glob/glob64.c

+ 3 - 1
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
 

+ 35 - 0
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));
+

+ 33 - 0
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