add GLOB_ALTDIRFUNC to have glob use alternate directory access functions
[unix-history] / usr / src / include / glob.h
CommitLineData
68a121a5
KB
1/*
2 * Copyright (c) 1989 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Guido van Rossum.
7 *
863005e5 8 * %sccs.include.redist.c%
68a121a5 9 *
bb047aa3 10 * @(#)glob.h 5.8 (Berkeley) %G%
68a121a5
KB
11 */
12
d2b7358e
KB
13#ifndef _GLOB_H_
14#define _GLOB_H_
15
68a121a5 16typedef struct {
3dd0f635
KB
17 int gl_pathc; /* count of total paths so far */
18 int gl_matchc; /* count of paths matching pattern */
68a121a5
KB
19 int gl_offs; /* reserved at beginning of gl_pathv */
20 int gl_flags; /* copy of flags parameter to glob() */
21 int (*gl_errfunc)(); /* copy of errfunc parameter to glob() */
bb047aa3
KM
22 void *(*gl_opendir)(); /* alternate opendir() function for glob() */
23 struct dirent *(*gl_readdir)(); /* alternate readdir() function */
24 void (*gl_closedir)(); /* alternate closedir() function for glob() */
25 int (*gl_lstat)(); /* alternate lstat() function for glob() */
26 int (*gl_stat)(); /* alternate stat() function for glob() */
68a121a5
KB
27 char **gl_pathv; /* list of paths matching pattern */
28} glob_t;
29
a5ba4a08
KB
30#define GLOB_APPEND 0x001 /* append to output from previous call */
31#define GLOB_DOOFFS 0x002 /* use gl_offs */
32#define GLOB_ERR 0x004 /* return on error */
33#define GLOB_MARK 0x008 /* append / to matching directories */
34#define GLOB_NOCHECK 0x010 /* return pattern itself if nothing matches */
35#define GLOB_NOSORT 0x020 /* don't sort */
36
68a121a5 37#ifndef _POSIX_SOURCE
a5ba4a08
KB
38#define GLOB_MAGCHAR 0x040 /* pattern had globbing characters */
39#define GLOB_NOMAGIC 0x080 /* GLOB_NOCHECK without magic chars (csh) */
40#define GLOB_QUOTE 0x100 /* quote special chars with \ */
bb047aa3 41#define GLOB_ALTDIRFUNC 0x200 /* use alternately specified directory funcs */
68a121a5
KB
42#endif
43
44#define GLOB_NOSPACE (-1) /* malloc call failed */
45#define GLOB_ABEND (-2) /* unignored error */
46
993000f1
DS
47#include <sys/cdefs.h>
48
49__BEGIN_DECLS
a5ba4a08
KB
50int glob __P((const char *, int, int (*)(char *, int), glob_t *));
51void globfree __P((glob_t *));
993000f1 52__END_DECLS
d2b7358e
KB
53
54#endif /* !_GLOB_H_ */