Remove building with NOCRYPTO option
[minix.git] / external / bsd / less / dist / lglob.h
blob04632e79f13e71847bf0cd9ae22544dc9e081d0b
1 /* $NetBSD: lglob.h,v 1.4 2013/09/04 19:44:21 tron Exp $ */
3 /*
4 * Copyright (C) 1984-2012 Mark Nudelman
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Less License, as specified in the README file.
9 * For more information, see the README file.
14 * Macros to define the method of doing filename "globbing".
15 * There are three possible mechanisms:
16 * 1. GLOB_LIST
17 * This defines a function that returns a list of matching filenames.
18 * 2. GLOB_NAME
19 * This defines a function that steps thru the list of matching
20 * filenames, returning one name each time it is called.
21 * 3. GLOB_STRING
22 * This defines a function that returns the complete list of
23 * matching filenames as a single space-separated string.
26 #if OS2
28 #define DECL_GLOB_LIST(list) char **list; char **pp;
29 #define GLOB_LIST(filename,list) list = _fnexplode(filename)
30 #define GLOB_LIST_FAILED(list) list == NULL
31 #define SCAN_GLOB_LIST(list,p) pp = list; *pp != NULL; pp++
32 #define INIT_GLOB_LIST(list,p) p = *pp
33 #define GLOB_LIST_DONE(list) _fnexplodefree(list)
35 #else
36 #if MSDOS_COMPILER==DJGPPC
38 #define DECL_GLOB_LIST(list) glob_t list; size_t i;
39 #define GLOB_LIST(filename,list) glob(filename,GLOB_NOCHECK,0,&list)
40 #define GLOB_LIST_FAILED(list) 0
41 #define SCAN_GLOB_LIST(list,p) i = 0; i < list.gl_pathc; i++
42 #define INIT_GLOB_LIST(list,p) p = list.gl_pathv[i]
43 #define GLOB_LIST_DONE(list) globfree(&list)
45 #else
46 #if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==BORLANDC
48 #define GLOB_FIRST_NAME(filename,fndp,h) h = _dos_findfirst(filename, ~_A_VOLID, fndp)
49 #define GLOB_FIRST_FAILED(handle) ((handle) != 0)
50 #define GLOB_NEXT_NAME(handle,fndp) _dos_findnext(fndp)
51 #define GLOB_NAME_DONE(handle)
52 #define GLOB_NAME name
53 #define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \
54 struct find_t fnd; \
55 char drive[_MAX_DRIVE]; \
56 char dir[_MAX_DIR]; \
57 char fname[_MAX_FNAME]; \
58 char ext[_MAX_EXT]; \
59 int handle;
60 #else
61 #if MSDOS_COMPILER==WIN32C && defined(_MSC_VER)
63 #define GLOB_FIRST_NAME(filename,fndp,h) h = _findfirst(filename, fndp)
64 #define GLOB_FIRST_FAILED(handle) ((handle) == -1)
65 #define GLOB_NEXT_NAME(handle,fndp) _findnext(handle, fndp)
66 #define GLOB_NAME_DONE(handle) _findclose(handle)
67 #define GLOB_NAME name
68 #define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \
69 struct _finddata_t fnd; \
70 char drive[_MAX_DRIVE]; \
71 char dir[_MAX_DIR]; \
72 char fname[_MAX_FNAME]; \
73 char ext[_MAX_EXT]; \
74 long handle;
76 #else
77 #if MSDOS_COMPILER==WIN32C && !defined(_MSC_VER) /* Borland C for Windows */
79 #define GLOB_FIRST_NAME(filename,fndp,h) h = findfirst(filename, fndp, ~FA_LABEL)
80 #define GLOB_FIRST_FAILED(handle) ((handle) != 0)
81 #define GLOB_NEXT_NAME(handle,fndp) findnext(fndp)
82 #define GLOB_NAME_DONE(handle)
83 #define GLOB_NAME ff_name
84 #define DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) \
85 struct ffblk fnd; \
86 char drive[MAXDRIVE]; \
87 char dir[MAXDIR]; \
88 char fname[MAXFILE]; \
89 char ext[MAXEXT]; \
90 int handle;
92 #endif
93 #endif
94 #endif
95 #endif
96 #endif