]> git.saurik.com Git - apple/libc.git/blobdiff - include/glob.h
Libc-1272.200.26.tar.gz
[apple/libc.git] / include / glob.h
index b749e3c17a6c053f9fa6b1f17a83e45de370033f..4f2b6843be3e262b1e1a6736cdecf5aa50bf7a4c 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
 #ifndef _GLOB_H_
 #define        _GLOB_H_
 
-#include <sys/cdefs.h>
 #include <_types.h>
+#include <sys/cdefs.h>
+#include <Availability.h>
+#include <sys/_types/_size_t.h>
 
-#ifndef _BSD_SIZE_T_DEFINED_
-#define _BSD_SIZE_T_DEFINED_
-typedef        __osx_size_t    size_t;
-#endif
-
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+struct dirent;
 struct stat;
+#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
 typedef struct {
        size_t gl_pathc;        /* Count of total paths so far. */
        int gl_matchc;          /* Count of paths matching pattern. */
@@ -56,7 +52,14 @@ typedef struct {
        int gl_flags;           /* Copy of flags parameter to glob. */
        char **gl_pathv;        /* List of paths matching pattern. */
                                /* Copy of errfunc parameter to glob. */
-       int (*gl_errfunc)(const char *, int);
+#ifdef __BLOCKS__
+       union {
+#endif /* __BLOCKS__ */
+               int (*gl_errfunc)(const char *, int);
+#ifdef __BLOCKS__
+               int (^gl_errblk)(const char *, int);
+       };
+#endif /* __BLOCKS__ */
 
        /*
         * Alternate filesystem access methods for glob; replacement
@@ -64,10 +67,19 @@ typedef struct {
         * and lstat(2).
         */
        void (*gl_closedir)(void *);
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
        struct dirent *(*gl_readdir)(void *);
+#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+       void *(*gl_readdir)(void *);
+#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
        void *(*gl_opendir)(const char *);
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
        int (*gl_lstat)(const char *, struct stat *);
        int (*gl_stat)(const char *, struct stat *);
+#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+       int (*gl_lstat)(const char *, void *);
+       int (*gl_stat)(const char *, void *);
+#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
 } glob_t;
 
 /* Believed to have been introduced in 1003.2-1992 */
@@ -85,7 +97,6 @@ typedef struct {
 #define        GLOB_NOMATCH    (-3)    /* No match and GLOB_NOCHECK was not set. */
 #define        GLOB_NOSYS      (-4)    /* Obsolete: source comptability only. */
 
-#ifndef _POSIX_SOURCE
 #define        GLOB_ALTDIRFUNC 0x0040  /* Use alternately specified directory funcs. */
 #define        GLOB_BRACE      0x0080  /* Expand braces ala csh. */
 #define        GLOB_MAGCHAR    0x0100  /* Pattern had globbing characters. */
@@ -93,15 +104,39 @@ typedef struct {
 #define        GLOB_QUOTE      0x0400  /* Quote special chars with \. */
 #define        GLOB_TILDE      0x0800  /* Expand tilde names from the passwd file. */
 #define        GLOB_LIMIT      0x1000  /* limit number of returned paths */
+#ifdef __BLOCKS__
+#define        _GLOB_ERR_BLOCK 0x80000000 /* (internal) error callback is a block */
+#endif /* __BLOCKS__ */
 
 /* source compatibility, these are the old names */
 #define GLOB_MAXPATH   GLOB_LIMIT
 #define        GLOB_ABEND      GLOB_ABORTED
-#endif /* ! _POSIX_SOURCE */
 
 __BEGIN_DECLS
-int    glob(const char * __restrict, int,
-           int (* __restrict)(const char *, int), glob_t * __restrict);
+//Begin-Libc
+#ifndef LIBC_ALIAS_GLOB
+//End-Libc
+int    glob(const char * __restrict, int, int (*)(const char *, int), 
+            glob_t * __restrict) __DARWIN_INODE64(glob);
+//Begin-Libc
+#else /* LIBC_ALIAS_GLOB */
+int    glob(const char * __restrict, int, int (*)(const char *, int), 
+            glob_t * __restrict) LIBC_INODE64(glob);
+#endif /* !LIBC_ALIAS_GLOB */
+//End-Libc
+#ifdef __BLOCKS__
+//Begin-Libc
+#ifndef LIBC_ALIAS_GLOB_B
+//End-Libc
+int    glob_b(const char * __restrict, int, int (^)(const char *, int), 
+            glob_t * __restrict) __DARWIN_INODE64(glob_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+//Begin-Libc
+#else /* LIBC_ALIAS_GLOB_B */
+int    glob_b(const char * __restrict, int, int (^)(const char *, int), 
+            glob_t * __restrict) LIBC_INODE64(glob_b);
+#endif /* !LIBC_ALIAS_GLOB_B */
+//End-Libc
+#endif /* __BLOCKS__ */
 void   globfree(glob_t *);
 __END_DECLS