summaryrefslogtreecommitdiff
path: root/include/glob.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/glob.h')
-rw-r--r--include/glob.h76
1 files changed, 51 insertions, 25 deletions
diff --git a/include/glob.h b/include/glob.h
index c4ad24f17..6bb7c7e8c 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -1,19 +1,20 @@
-/* Copyright (C) 1991, 92, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95,96,97,98,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
The GNU C Library 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.
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#ifndef _GLOB_H
#define _GLOB_H 1
@@ -106,7 +107,9 @@ typedef unsigned long int __size_t;
/* Structure describing a globbing run. */
#if !defined _AMIGA && !defined VMS /* Buggy compiler. */
+# ifdef _GNU_SOURCE
struct stat;
+# endif
#endif
typedef struct
{
@@ -118,14 +121,26 @@ typedef struct
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) __PMT ((void *));
+#ifdef _GNU_SOURCE
struct dirent *(*gl_readdir) __PMT ((void *));
+#else
+ void *(*gl_readdir) __PMT ((void *));
+#endif
__ptr_t (*gl_opendir) __PMT ((__const char *));
- int (*gl_lstat) __PMT ((__const char *, struct stat *));
- int (*gl_stat) __PMT ((__const char *, struct stat *));
+#ifdef _GNU_SOURCE
+ int (*gl_lstat) __PMT ((__const char *__restrict,
+ struct stat *__restrict));
+ int (*gl_stat) __PMT ((__const char *__restrict, struct stat *__restrict));
+#else
+ int (*gl_lstat) __PMT ((__const char *__restrict, void *__restrict));
+ int (*gl_stat) __PMT ((__const char *__restrict, void *__restrict));
+#endif
} glob_t;
#ifdef _LARGEFILE64_SOURCE
+# ifdef _GNU_SOURCE
struct stat64;
+# endif
typedef struct
{
__size_t gl_pathc;
@@ -136,13 +151,29 @@ typedef struct
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) __PMT ((void *));
+# ifdef _GNU_SOURCE
struct dirent64 *(*gl_readdir) __PMT ((void *));
+# else
+ void *(*gl_readdir) __PMT ((void *));
+# endif
__ptr_t (*gl_opendir) __PMT ((__const char *));
- int (*gl_lstat) __PMT ((__const char *, struct stat64 *));
- int (*gl_stat) __PMT ((__const char *, struct stat64 *));
+# ifdef _GNU_SOURCE
+ int (*gl_lstat) __PMT ((__const char *__restrict,
+ struct stat64 *__restrict));
+ int (*gl_stat) __PMT ((__const char *__restrict,
+ struct stat64 *__restrict));
+# else
+ int (*gl_lstat) __PMT ((__const char *__restrict, void *__restrict));
+ int (*gl_stat) __PMT ((__const char *__restrict, void *__restrict));
+# endif
} glob64_t;
#endif
+#if _FILE_OFFSET_BITS == 64 && __GNUC__ < 2
+# define glob glob64
+# define globfree globfree64
+#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,
@@ -151,30 +182,25 @@ typedef struct
`glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
-#if _FILE_OFFSET_BITS != 64
-extern int glob __P ((__const char *__pattern, int __flags,
+#if _FILE_OFFSET_BITS != 64 || __GNUC__ < 2
+extern int glob __P ((__const char *__restrict __pattern, int __flags,
int (*__errfunc) (__const char *, int),
- glob_t *__pglob));
+ glob_t *__restrict __pglob));
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree __P ((glob_t *__pglob));
#else
-# if __GNUC__ >= 2
-extern int glob __P ((__const char *__pattern, int __flags,
+extern int glob __P ((__const char *__restrict __pattern, int __flags,
int (*__errfunc) (__const char *, int),
- glob_t *__pglob)) __asm__ ("glob64");
+ glob_t *__restrict __pglob)) __asm__ ("glob64");
extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64");
-# else
-# define glob glob64
-# define globfree globfree64
-# endif
#endif
#ifdef _LARGEFILE64_SOURCE
-extern int glob64 __P ((__const char *__pattern, int __flags,
+extern int glob64 __P ((__const char *__restrict __pattern, int __flags,
int (*__errfunc) (__const char *, int),
- glob64_t *__pglob));
+ glob64_t *__restrict __pglob));
extern void globfree64 __P ((glob64_t *__pglob));
#endif