xref: /dflybsd-src/contrib/grep/lib/exclude.h (revision 95b7b45377d922df3f9cbf9a1f160c77aa3555fa)
1*95b7b453SJohn Marino /* exclude.h -- declarations for excluding file names
2*95b7b453SJohn Marino 
3*95b7b453SJohn Marino    Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001, 2002, 2003, 2005, 2006,
4*95b7b453SJohn Marino    2009, 2010 Free Software Foundation, Inc.
5*95b7b453SJohn Marino 
6*95b7b453SJohn Marino    This program is free software: you can redistribute it and/or modify
7*95b7b453SJohn Marino    it under the terms of the GNU General Public License as published by
8*95b7b453SJohn Marino    the Free Software Foundation; either version 3 of the License, or
9*95b7b453SJohn Marino    (at your option) any later version.
10*95b7b453SJohn Marino 
11*95b7b453SJohn Marino    This program is distributed in the hope that it will be useful,
12*95b7b453SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*95b7b453SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*95b7b453SJohn Marino    GNU General Public License for more details.
15*95b7b453SJohn Marino 
16*95b7b453SJohn Marino    You should have received a copy of the GNU General Public License
17*95b7b453SJohn Marino    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18*95b7b453SJohn Marino 
19*95b7b453SJohn Marino #ifndef _GL_EXCLUDE_H
20*95b7b453SJohn Marino #define _GL_EXCLUDE_H 1
21*95b7b453SJohn Marino 
22*95b7b453SJohn Marino #include <stdbool.h>
23*95b7b453SJohn Marino 
24*95b7b453SJohn Marino /* Written by Paul Eggert <eggert@twinsun.com>
25*95b7b453SJohn Marino    and Sergey Poznyakoff <gray@gnu.org> */
26*95b7b453SJohn Marino 
27*95b7b453SJohn Marino /* Exclude options, which can be ORed with fnmatch options.  */
28*95b7b453SJohn Marino 
29*95b7b453SJohn Marino /* Patterns must match the start of file names, instead of matching
30*95b7b453SJohn Marino    anywhere after a '/'.  */
31*95b7b453SJohn Marino #define EXCLUDE_ANCHORED (1 << 30)
32*95b7b453SJohn Marino 
33*95b7b453SJohn Marino /* Include instead of exclude.  */
34*95b7b453SJohn Marino #define EXCLUDE_INCLUDE (1 << 29)
35*95b7b453SJohn Marino 
36*95b7b453SJohn Marino /* '?', '*', '[', and '\\' are special in patterns.  Without this
37*95b7b453SJohn Marino    option, these characters are ordinary and fnmatch is not used.  */
38*95b7b453SJohn Marino #define EXCLUDE_WILDCARDS (1 << 28)
39*95b7b453SJohn Marino 
40*95b7b453SJohn Marino struct exclude;
41*95b7b453SJohn Marino 
42*95b7b453SJohn Marino bool fnmatch_pattern_has_wildcards (const char *, int);
43*95b7b453SJohn Marino 
44*95b7b453SJohn Marino struct exclude *new_exclude (void);
45*95b7b453SJohn Marino void free_exclude (struct exclude *);
46*95b7b453SJohn Marino void add_exclude (struct exclude *, char const *, int);
47*95b7b453SJohn Marino int add_exclude_file (void (*) (struct exclude *, char const *, int),
48*95b7b453SJohn Marino                       struct exclude *, char const *, int, char);
49*95b7b453SJohn Marino bool excluded_file_name (struct exclude const *, char const *);
50*95b7b453SJohn Marino bool exclude_fnmatch (char const *pattern, char const *f, int options);
51*95b7b453SJohn Marino 
52*95b7b453SJohn Marino #endif /* _GL_EXCLUDE_H */
53