summaryrefslogtreecommitdiff
path: root/src/grep.c
blob: 8ef4968396bba2396949013b0aff74009fbbc320 (plain)
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
35
36
37
38
#include <config.h>
#include "search.h"

static void
Gcompile (char const *pattern, size_t size)
{
  return GEAcompile (pattern, size,
		     RE_SYNTAX_GREP
		     | RE_HAT_LISTS_NOT_NEWLINE
		     | RE_NO_EMPTY_RANGES);
}

static void
Ecompile (char const *pattern, size_t size)
{
  return GEAcompile (pattern, size, RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES);
}

static void
Acompile (char const *pattern, size_t size)
{
  return GEAcompile (pattern, size, RE_SYNTAX_AWK);
}

struct matcher const matchers[] = {
  { "grep",    Gcompile, EGexecute },
  { "egrep",   Ecompile, EGexecute },
  { "awk",     Acompile, EGexecute },
  { "fgrep",   Fcompile, Fexecute },
  { "perl",    Pcompile, Pexecute },
  { NULL, NULL, NULL },
};

const char before_options[] =
N_("PATTERN is, by default, a basic regular expression (BRE).\n");
const char after_options[] =
N_("`egrep' means `grep -E'.  `fgrep' means `grep -F'.\n\
Direct invocation as either `egrep' or `fgrep' is deprecated.\n");