Annotation of src/usr.bin/less/lglob.h, Revision 1.2
1.1 millert 1: /*
2: * Copyright (C) 1984-2002 Mark Nudelman
3: *
4: * You may distribute under the terms of either the GNU General Public
5: * License or the Less License, as specified in the README file.
6: *
7: * For more information about less, or for information on how to
8: * contact the author, see the README file.
9: */
10:
11:
12: /*
13: * Macros to define the method of doing filename "globbing".
14: * There are three possible mechanisms:
15: * 1. GLOB_LIST
16: * This defines a function that returns a list of matching filenames.
17: * 2. GLOB_NAME
18: * This defines a function that steps thru the list of matching
19: * filenames, returning one name each time it is called.
20: * 3. GLOB_STRING
21: * This defines a function that returns the complete list of
22: * matching filenames as a single space-separated string.
23: */
24:
1.2 ! millert 25: #include <glob.h>
1.1 millert 26:
27: #define DECL_GLOB_LIST(list) glob_t list; int i;
28: #define GLOB_LIST(filename,list) glob(filename,GLOB_NOCHECK,0,&list)
29: #define GLOB_LIST_FAILED(list) 0
30: #define SCAN_GLOB_LIST(list,p) i = 0; i < list.gl_pathc; i++
31: #define INIT_GLOB_LIST(list,p) p = list.gl_pathv[i]
32: #define GLOB_LIST_DONE(list) globfree(&list)