1 //
2 // Copyright(C) 2018 Simon Howard
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // DESCRIPTION:
15 //	System specific file globbing interface.
16 //
17 
18 
19 #ifndef __I_GLOB__
20 #define __I_GLOB__
21 
22 #define GLOB_FLAG_NOCASE  0x01
23 #define GLOB_FLAG_SORTED  0x02
24 
25 typedef struct glob_s glob_t;
26 
27 // Start reading a list of file paths from the given directory which match
28 // the given glob pattern. I_EndGlob() must be called on completion.
29 glob_t *I_StartGlob(const char *directory, const char *glob, int flags);
30 
31 // Same as I_StartGlob but multiple glob patterns can be provided. The list
32 // of patterns must be terminated with NULL.
33 glob_t *I_StartMultiGlob(const char *directory, int flags,
34                          const char *glob, ...);
35 
36 // Finish reading file list.
37 void I_EndGlob(glob_t *glob);
38 
39 // Read the name of the next globbed filename. NULL is returned if there
40 // are no more found.
41 const char *I_NextGlob(glob_t *glob);
42 
43 #endif
44 
45