File: matcher.h

package info (click to toggle)
grep-dctrl 1.3a
  • links: PTS
  • area: main
  • in suites: potato
  • size: 660 kB
  • ctags: 403
  • sloc: ansic: 4,004; sh: 358; makefile: 226; sed: 93
file content (34 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34


#ifndef MATCHER_H__
#define MATCHER_H__

#include <stdio.h>
#include <regex.h>

enum match_type_t { MATCH_FIXED, MATCH_EXACT, MATCH_REGEX };

union pattern_t {
  const char * fixed;
  regex_t * regex;
};

struct matcher_t {
  enum match_type_t type;
  int case_sensitive; /* flag */
  int show_fieldnames; /* flag */
  int exact_match; /* flag */
  int inverse; /* flag: true iff print those paras that don't match */
  const char * field;
  union pattern_t pattern;
};

/* Return true if all went well. */
int
grep_control (struct matcher_t * matcher, FILE * f, char * show_fields [],
              const char * fname);

char *
get_regerror (int errcode, regex_t *compiled);

#endif /* MATCHER_H__ */