posix: Consolidate Linux glob implementation
[glibc.git] / sysdeps / unix / sysv / linux / oldglob.c
blob5402450f5579db4081fba37a02ada23903cd869e
1 #include <shlib-compat.h>
3 #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) \
4 && !defined(GLOB_NO_OLD_VERSION)
6 #include <dirent.h>
7 #include <glob.h>
8 #include <sys/stat.h>
10 #include <olddirent.h>
12 int __old_glob64 (const char *__pattern, int __flags,
13 int (*__errfunc) (const char *, int),
14 glob64_t *__pglob);
15 libc_hidden_proto (__old_glob64);
17 #define dirent __old_dirent64
18 #define GL_READDIR(pglob, stream) \
19 ((struct __old_dirent64 *) (pglob)->gl_readdir (stream))
20 #undef __readdir
21 #define __readdir(dirp) __old_readdir64 (dirp)
23 #define glob_t glob64_t
24 #define glob(pattern, flags, errfunc, pglob) \
25 __old_glob64 (pattern, flags, errfunc, pglob)
26 #define globfree(pglob) globfree64(pglob)
28 #define convert_dirent __old_convert_dirent
29 #define glob_in_dir __old_glob_in_dir
31 #undef stat
32 #define stat stat64
33 #undef __stat
34 #define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
36 #define GLOB_ATTRIBUTE attribute_compat_text_section
38 #include <posix/glob.c>
40 libc_hidden_def (__old_glob64);
42 compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1);
43 #endif