[uClibc-cvs] uClibc/libc/misc/glob glob.c,1.6,1.7 glob64.c,1.3,1.4
Erik Andersen
andersen at uclibc.org
Sun Oct 12 04:41:14 UTC 2003
Update of /var/cvs/uClibc/libc/misc/glob
In directory winder:/tmp/cvs-serv23627
Modified Files:
glob.c glob64.c
Log Message:
Don't make two copies
Index: glob64.c
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/glob/glob64.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- glob64.c 31 Oct 2002 18:19:32 -0000 1.3
+++ glob64.c 12 Oct 2003 04:41:11 -0000 1.4
@@ -30,6 +30,8 @@
#define stat stat64
#define lstat lstat64
+#define __GLOB64 1
+
#include "glob.c"
#endif
Index: glob.c
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/glob/glob.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- glob.c 12 Oct 2003 04:19:38 -0000 1.6
+++ glob.c 12 Oct 2003 04:41:11 -0000 1.7
@@ -25,10 +25,10 @@
#include <dirent.h>
#include <malloc.h>
#include <fnmatch.h>
+#define _GNU_SOURCE
#include <glob.h>
extern __ptr_t (*__glob_opendir_hook) __P ((const char *directory));
-extern int glob_pattern_p __P ((__const char *__pattern, int __quote));
extern void (*__glob_closedir_hook) __P ((__ptr_t stream));
extern const char *(*__glob_readdir_hook) __P ((__ptr_t stream));
@@ -41,6 +41,43 @@
int add_slash));
static int collated_compare __P ((const __ptr_t, const __ptr_t));
+#ifdef __GLOB64
+extern int glob_pattern_p(const char *pattern, int quote);
+#else
+/* 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)
+{
+ const char *p;
+ int open = 0;
+
+ for (p = pattern; *p != '\0'; ++p)
+ switch (*p)
+ {
+ case '?':
+ case '*':
+ return 1;
+
+ case '\\':
+ if (quote)
+ ++p;
+ break;
+
+ case '[':
+ open = 1;
+ break;
+
+ case ']':
+ if (open)
+ return 1;
+ break;
+ }
+
+ return 0;
+}
+#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,
@@ -332,39 +369,6 @@
}
-/* 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)
-{
- register const char *p;
- int open = 0;
-
- for (p = pattern; *p != '\0'; ++p)
- switch (*p)
- {
- case '?':
- case '*':
- return 1;
-
- case '\\':
- if (quote)
- ++p;
- break;
-
- case '[':
- open = 1;
- break;
-
- case ']':
- if (open)
- return 1;
- break;
- }
-
- return 0;
-}
-
-
/* Like `glob', but PATTERN is a final pathname component,
and matches are searched for in DIRECTORY.
The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
More information about the uClibc-cvs
mailing list