Deleted Added
full compact
grep.h (210461) grep.h (210578)
1/* $OpenBSD: grep.h,v 1.15 2010/04/05 03:03:55 tedu Exp $ */
1/* $OpenBSD: grep.h,v 1.15 2010/04/05 03:03:55 tedu Exp $ */
2/* $FreeBSD: head/usr.bin/grep/grep.h 210461 2010-07-25 08:42:18Z gabor $ */
2/* $FreeBSD: head/usr.bin/grep/grep.h 210578 2010-07-29 00:11:14Z gabor $ */
3
4/*-
5 * Copyright (c) 1999 James Howard and Dag-Erling Co�dan Sm�rgrav
6 * Copyright (c) 2008-2009 Gabor Kovesdan <gabor@FreeBSD.org>
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

--- 55 unchanged lines hidden (view full) ---

66
67#define DEV_READ 0
68#define DEV_SKIP 1
69
70#define LINK_READ 0
71#define LINK_EXPLICIT 1
72#define LINK_SKIP 2
73
3
4/*-
5 * Copyright (c) 1999 James Howard and Dag-Erling Co�dan Sm�rgrav
6 * Copyright (c) 2008-2009 Gabor Kovesdan <gabor@FreeBSD.org>
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

--- 55 unchanged lines hidden (view full) ---

66
67#define DEV_READ 0
68#define DEV_SKIP 1
69
70#define LINK_READ 0
71#define LINK_EXPLICIT 1
72#define LINK_SKIP 2
73
74#define FILE_PAT 0
75#define DIR_PAT 1
76#define EXCL_PAT 0
77#define INCL_PAT 1
78
79#define MAX_LINE_MATCHES 32
80
81struct file {
82 struct mmfile *mmf;
83 BZFILE *bzf;

--- 9 unchanged lines hidden (view full) ---

93 char *dat;
94 char *file;
95 int line_no;
96};
97
98struct epat {
99 char *pat;
100 int mode;
74#define EXCL_PAT 0
75#define INCL_PAT 1
76
77#define MAX_LINE_MATCHES 32
78
79struct file {
80 struct mmfile *mmf;
81 BZFILE *bzf;

--- 9 unchanged lines hidden (view full) ---

91 char *dat;
92 char *file;
93 int line_no;
94};
95
96struct epat {
97 char *pat;
98 int mode;
101 int type;
102};
103
104typedef struct {
105 size_t len;
106 unsigned char *pattern;
107 int qsBc[UCHAR_MAX + 1];
108 /* flags */
109 bool bol;
110 bool eol;
111 bool reversed;
112} fastgrep_t;
113
114/* Flags passed to regcomp() and regexec() */
115extern int cflags, eflags;
116
117/* Command line flags */
118extern bool Eflag, Fflag, Gflag, Hflag, Lflag,
119 bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag,
120 qflag, sflag, vflag, wflag, xflag;
99};
100
101typedef struct {
102 size_t len;
103 unsigned char *pattern;
104 int qsBc[UCHAR_MAX + 1];
105 /* flags */
106 bool bol;
107 bool eol;
108 bool reversed;
109} fastgrep_t;
110
111/* Flags passed to regcomp() and regexec() */
112extern int cflags, eflags;
113
114/* Command line flags */
115extern bool Eflag, Fflag, Gflag, Hflag, Lflag,
116 bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag,
117 qflag, sflag, vflag, wflag, xflag;
121extern bool exclflag, nullflag;
118extern bool dexclude, dinclude, fexclude, finclude, nullflag;
122extern unsigned long long Aflag, Bflag, mcount;
123extern char *label;
124extern const char *color;
125extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave;
126
127extern bool first, matchall, notfound, prev;
128extern int tail;
119extern unsigned long long Aflag, Bflag, mcount;
120extern char *label;
121extern const char *color;
122extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave;
123
124extern bool first, matchall, notfound, prev;
125extern int tail;
129extern unsigned int epatterns, patterns;
126extern unsigned int dpatterns, fpatterns, patterns;
130extern char **pattern;
127extern char **pattern;
131extern struct epat *epattern;
128extern struct epat *dpattern, *fpattern;
132extern regex_t *er_pattern, *r_pattern;
133extern fastgrep_t *fg_pattern;
134
135/* For regex errors */
136#define RE_ERROR_BUF 512
137extern char re_error[RE_ERROR_BUF + 1]; /* Seems big enough */
138
139/* util.c */
129extern regex_t *er_pattern, *r_pattern;
130extern fastgrep_t *fg_pattern;
131
132/* For regex errors */
133#define RE_ERROR_BUF 512
134extern char re_error[RE_ERROR_BUF + 1]; /* Seems big enough */
135
136/* util.c */
137bool dir_matching(const char *dname);
138bool file_matching(const char *fname);
140int procfile(const char *fn);
141int grep_tree(char **argv);
142void *grep_malloc(size_t size);
143void *grep_calloc(size_t nmemb, size_t size);
144void *grep_realloc(void *ptr, size_t size);
139int procfile(const char *fn);
140int grep_tree(char **argv);
141void *grep_malloc(size_t size);
142void *grep_calloc(size_t nmemb, size_t size);
143void *grep_realloc(void *ptr, size_t size);
144char *grep_strdup(const char *str);
145void printline(struct str *line, int sep, regmatch_t *matches, int m);
146
147/* queue.c */
148void enqueue(struct str *x);
149void printqueue(void);
150void clearqueue(void);
151
152/* file.c */
153void grep_close(struct file *f);
154struct file *grep_stdin_open(void);
155struct file *grep_open(const char *path);
156int grep_feof(struct file *f);
157int grep_fgetc(struct file *f);
158char *grep_fgetln(struct file *f, size_t *len);
159
160/* fastgrep.c */
161int fastcomp(fastgrep_t *, const char *);
162void fgrepcomp(fastgrep_t *, const char *);
163int grep_search(fastgrep_t *, unsigned char *, size_t, regmatch_t *);
145void printline(struct str *line, int sep, regmatch_t *matches, int m);
146
147/* queue.c */
148void enqueue(struct str *x);
149void printqueue(void);
150void clearqueue(void);
151
152/* file.c */
153void grep_close(struct file *f);
154struct file *grep_stdin_open(void);
155struct file *grep_open(const char *path);
156int grep_feof(struct file *f);
157int grep_fgetc(struct file *f);
158char *grep_fgetln(struct file *f, size_t *len);
159
160/* fastgrep.c */
161int fastcomp(fastgrep_t *, const char *);
162void fgrepcomp(fastgrep_t *, const char *);
163int grep_search(fastgrep_t *, unsigned char *, size_t, regmatch_t *);