Annotation of src/usr.bin/less/lglob.h, Revision 1.1.1.3
1.1 millert 1: /*
1.1.1.3 ! shadchin 2: * Copyright (C) 1984-2012 Mark Nudelman
1.1 millert 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: *
1.1.1.3 ! shadchin 7: * For more information, see the README file.
1.1 millert 8: */
9:
10:
11: /*
12: * Macros to define the method of doing filename "globbing".
13: * There are three possible mechanisms:
14: * 1. GLOB_LIST
15: * This defines a function that returns a list of matching filenames.
16: * 2. GLOB_NAME
17: * This defines a function that steps thru the list of matching
18: * filenames, returning one name each time it is called.
19: * 3. GLOB_STRING
20: * This defines a function that returns the complete list of
21: * matching filenames as a single space-separated string.
22: */
23:
1.1.1.3 ! shadchin 24: #include <glob.h>
1.1 millert 25:
1.1.1.3 ! shadchin 26: #define GLOB_FLAGS (GLOB_NOCHECK|GLOB_BRACE|GLOB_TILDE)
1.1 millert 27: #define DECL_GLOB_LIST(list) glob_t list; int i;
1.1.1.3 ! shadchin 28: #define GLOB_LIST(filename,list) glob(filename,GLOB_FLAGS,0,&list)
1.1 millert 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)