author | Lars Hjemli <hjemli@gmail.com> | 2006-12-28 01:45:28 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-28 01:45:28 (UTC) |
commit | 732d68d240b95dc428c92fc94bce9adb8912094e (patch) (unidiff) | |
tree | 24c6ab907c2a8574da12e426144706ad63780868 /git.h | |
parent | e39d738c39d37cdef115c145027f3eec85a62272 (diff) | |
download | cgit-732d68d240b95dc428c92fc94bce9adb8912094e.zip cgit-732d68d240b95dc428c92fc94bce9adb8912094e.tar.gz cgit-732d68d240b95dc428c92fc94bce9adb8912094e.tar.bz2 |
Add basic log filtering
This enables case-insensitive grep on logentris using the new search box
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | git.h | 68 |
1 files changed, 67 insertions, 1 deletions
@@ -30,9 +30,9 @@ | |||
30 | #include <netinet/in.h> | 30 | #include <netinet/in.h> |
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | #include <dirent.h> | 32 | #include <dirent.h> |
33 | #include <time.h> | 33 | #include <time.h> |
34 | 34 | #include <regex.h> | |
35 | 35 | ||
36 | /* On most systems <limits.h> would have given us this, but | 36 | /* On most systems <limits.h> would have given us this, but |
37 | * not on some systems (e.g. GNU/Hurd). | 37 | * not on some systems (e.g. GNU/Hurd). |
38 | */ | 38 | */ |
@@ -155,8 +155,74 @@ static inline void hashclr(unsigned char *hash) | |||
155 | memset(hash, 0, 20); | 155 | memset(hash, 0, 20); |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | /* | ||
160 | * from git:grep.h | ||
161 | */ | ||
162 | |||
163 | enum grep_pat_token { | ||
164 | GREP_PATTERN, | ||
165 | GREP_PATTERN_HEAD, | ||
166 | GREP_PATTERN_BODY, | ||
167 | GREP_AND, | ||
168 | GREP_OPEN_PAREN, | ||
169 | GREP_CLOSE_PAREN, | ||
170 | GREP_NOT, | ||
171 | GREP_OR, | ||
172 | }; | ||
173 | |||
174 | enum grep_context { | ||
175 | GREP_CONTEXT_HEAD, | ||
176 | GREP_CONTEXT_BODY, | ||
177 | }; | ||
178 | |||
179 | struct grep_pat { | ||
180 | struct grep_pat *next; | ||
181 | const char *origin; | ||
182 | int no; | ||
183 | enum grep_pat_token token; | ||
184 | const char *pattern; | ||
185 | regex_t regexp; | ||
186 | }; | ||
187 | |||
188 | enum grep_expr_node { | ||
189 | GREP_NODE_ATOM, | ||
190 | GREP_NODE_NOT, | ||
191 | GREP_NODE_AND, | ||
192 | GREP_NODE_OR, | ||
193 | }; | ||
194 | |||
195 | struct grep_opt { | ||
196 | struct grep_pat *pattern_list; | ||
197 | struct grep_pat **pattern_tail; | ||
198 | struct grep_expr *pattern_expression; | ||
199 | int prefix_length; | ||
200 | regex_t regexp; | ||
201 | unsigned linenum:1; | ||
202 | unsigned invert:1; | ||
203 | unsigned status_only:1; | ||
204 | unsigned name_only:1; | ||
205 | unsigned unmatch_name_only:1; | ||
206 | unsigned count:1; | ||
207 | unsigned word_regexp:1; | ||
208 | unsigned fixed:1; | ||
209 | unsigned all_match:1; | ||
210 | #define GREP_BINARY_DEFAULT 0 | ||
211 | #define GREP_BINARY_NOMATCH 1 | ||
212 | #define GREP_BINARY_TEXT 2 | ||
213 | unsigned binary:2; | ||
214 | unsigned extended:1; | ||
215 | unsigned relative:1; | ||
216 | unsigned pathname:1; | ||
217 | int regflags; | ||
218 | unsigned pre_context; | ||
219 | unsigned post_context; | ||
220 | }; | ||
221 | |||
222 | |||
223 | extern void compile_grep_patterns(struct grep_opt *opt); | ||
224 | extern void free_grep_patterns(struct grep_opt *opt); | ||
159 | 225 | ||
160 | 226 | ||
161 | /* | 227 | /* |
162 | * from git:object.h | 228 | * from git:object.h |