Debian Codegraph @

lib/exclude.h

raw
1 /* exclude.h -- declarations for excluding file names
2
3 Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2025 Free
4 Software Foundation, Inc.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19 /* Written by Paul Eggert <[email protected]>
20 and Sergey Poznyakoff <[email protected]> */
21
22 #ifndef _GL_EXCLUDE_H
23 #define _GL_EXCLUDE_H 1
24
25 /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
26 _GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL. */
27 #if !_GL_CONFIG_H_INCLUDED
28 #error "Please include config.h first."
29 #endif
30
31 #include <stdio.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37
38 /* Exclude options, which can be ORed with fnmatch options. */
39
40 /* Patterns must match the start of file names, instead of matching
41 anywhere after a '/'. */
42 #define EXCLUDE_ANCHORED (1 << 30)
43
44 /* Include instead of exclude. */
45 #define EXCLUDE_INCLUDE (1 << 29)
46
47 /* '?', '*', '[', and '\\' are special in patterns. Without this
48 option, these characters are ordinary and fnmatch is not used. */
49 #define EXCLUDE_WILDCARDS (1 << 28)
50
51 /* Patterns are POSIX extended regular expressions */
52 #define EXCLUDE_REGEX (1 << 27)
53
54 /* Allocate storage for the pattern */
55 #define EXCLUDE_ALLOC (1 << 26)
56
57 struct exclude;
58
59 bool fnmatch_pattern_has_wildcards (const char *, int) _GL_ATTRIBUTE_PURE;
60
61 void free_exclude (struct exclude *)
62 _GL_ATTRIBUTE_NONNULL ((1));
63 struct exclude *new_exclude (void)
64 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_RETURNS_NONNULL
65 _GL_ATTRIBUTE_DEALLOC (free_exclude, 1);
66 void add_exclude (struct exclude *, char const *, int);
67 int add_exclude_file (void (*) (struct exclude *, char const *, int),
68 struct exclude *, char const *, int, char);
69 int add_exclude_fp (void (*) (struct exclude *, char const *, int, void *),
70 struct exclude *, FILE *, int, char, void *);
71 bool excluded_file_name (struct exclude const *, char const *);
72 void exclude_add_pattern_buffer (struct exclude *ex, char *buf);
73 bool exclude_fnmatch (char const *, char const *, int);
74
75
76 #ifdef __cplusplus
77 }
78 #endif
79
80 #endif /* _GL_EXCLUDE_H */