* Updated glob.h and its implementation to FreeBSD current (1.10, 1.27),

adapted them to work on Haiku.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28355 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-28 14:13:30 +00:00
parent f20ccdc461
commit 6e036f0479
2 changed files with 211 additions and 178 deletions
+16 -18
View File
@@ -32,22 +32,23 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)glob.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _GLOB_H_
#define _GLOB_H_
#include <sys/cdefs.h>
#include <sys/types.h>
struct stat;
typedef struct {
int gl_pathc; /* Count of total paths so far. */
int gl_matchc; /* Count of paths matching pattern. */
int gl_offs; /* Reserved at beginning of gl_pathv. */
size_t gl_pathc; /* Count of total paths so far. */
size_t gl_matchc; /* Count of paths matching pattern. */
size_t gl_offs; /* Reserved at beginning of gl_pathv. */
int gl_flags; /* Copy of flags parameter to glob. */
char **gl_pathv; /* List of paths matching pattern. */
int (*gl_errfunc)(const char *, int);
/* Copy of errfunc parameter to glob. */
int (*gl_errfunc)(const char *, int);
/*
* Alternate filesystem access methods for glob; replacement
@@ -61,7 +62,6 @@ typedef struct {
int (*gl_stat)(const char *, struct stat *);
} glob_t;
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
#define GLOB_ERR 0x0004 /* Return on error. */
@@ -74,6 +74,7 @@ typedef struct {
#define GLOB_NOSPACE (-1) /* Malloc call failed. */
#define GLOB_ABORTED (-2) /* Unignored error. */
#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK was not set. */
#define GLOB_NOSYS (-4) /* Obsolete: source comptability only. */
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
@@ -83,16 +84,13 @@ typedef struct {
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
#define GLOB_LIMIT 0x1000 /* limit number of returned paths */
/* source compatibility, these are the old names */
#define GLOB_MAXPATH GLOB_LIMIT
#define GLOB_ABEND GLOB_ABORTED
#ifdef __cplusplus
extern "C" {
#endif
__BEGIN_DECLS
int glob(const char *, int, int (*)(const char *, int), glob_t *);
void globfree(glob_t *);
__END_DECLS
extern int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *);
extern void globfree(glob_t *);
#ifdef __cplusplus
}
#endif
#endif /* _GLOB_H_ */
#endif /* !_GLOB_H_ */