Lines Matching +full:buffered +full:- +full:negative

4 /*-
5 * SPDX-License-Identifier: BSD-2-Clause
7 * Copyright (c) 1999 James Howard and Dag-Erling Smørgrav
8 * Copyright (C) 2008-2009 Gabor Kovesdan <gabor@FreeBSD.org>
57 /* 3*/ "usage: %s [-abcDEFGHhIiLlmnOopqRSsUVvwxz] [-A num] [-B num] [-C num]\n",
58 /* 4*/ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n",
59 /* 5*/ "\t[--context=num] [--directories=action] [--label] [--line-buffered]\n",
60 /* 6*/ "\t[--null] [pattern] [file ...]\n",
85 /* Command-line flags */
86 long long Aflag; /* -A x: print x lines trailing each match */
87 long long Bflag; /* -B x: print x lines leading each match */
88 bool Hflag; /* -H: always print file name */
89 bool Lflag; /* -L: only show names of files with no matches */
90 bool bflag; /* -b: show block numbers for each match */
91 bool cflag; /* -c: only show a count of matching lines */
92 bool hflag; /* -h: don't print filename headers */
93 bool iflag; /* -i: ignore case */
94 bool lflag; /* -l: only show names of files with matches */
95 bool mflag; /* -m x: stop reading the files after x matches */
96 long long mcount; /* count for -m */
97 long long mlimit; /* requested value for -m */
99 bool nflag; /* -n: show line numbers in front of matching lines */
100 bool oflag; /* -o: print only matching part */
101 bool qflag; /* -q: quiet mode (don't output anything) */
102 bool sflag; /* -s: silent mode (ignore errors) */
103 bool vflag; /* -v: only show non-matching lines */
104 bool wflag; /* -w: pattern must start and end on word boundaries */
105 bool xflag; /* -x: pattern must match entire line */
106 bool lbflag; /* --line-buffered */
107 bool nullflag; /* --null */
108 char *label; /* --label */
109 const char *color; /* --color */
110 int grepbehave = GREP_BASIC; /* -EFG: type of the regex */
111 int binbehave = BINFILE_BIN; /* -aIU: handling of binary files */
113 int devbehave = DEV_READ; /* -D: handling of devices */
114 int dirbehave = DIR_READ; /* -dRr: handling of directories */
115 int linkbehave = LINK_SKIP; /* -OpS: handling of symlinks */
117 bool dexclude, dinclude; /* --exclude-dir and --include-dir */
118 bool fexclude, finclude; /* --exclude and --include */
156 {"binary-files", required_argument, NULL, BIN_OPT},
159 {"line-buffered", no_argument, NULL, LINEBUF_OPT},
166 {"exclude-dir", required_argument, NULL, R_DEXCLUDE_OPT},
167 {"include-dir", required_argument, NULL, R_DINCLUDE_OPT},
168 {"after-context", required_argument, NULL, 'A'},
170 {"before-context", required_argument, NULL, 'B'},
171 {"byte-offset", no_argument, NULL, 'b'},
176 {"extended-regexp", no_argument, NULL, 'E'},
178 {"fixed-strings", no_argument, NULL, 'F'},
180 {"basic-regexp", no_argument, NULL, 'G'},
181 {"no-filename", no_argument, NULL, 'h'},
182 {"with-filename", no_argument, NULL, 'H'},
183 {"ignore-case", no_argument, NULL, 'i'},
184 {"files-with-matches", no_argument, NULL, 'l'},
185 {"files-without-match", no_argument, NULL, 'L'},
186 {"max-count", required_argument, NULL, 'm'},
187 {"line-number", no_argument, NULL, 'n'},
188 {"only-matching", no_argument, NULL, 'o'},
192 {"no-messages", no_argument, NULL, 's'},
194 {"unix-byte-offsets", no_argument, NULL, 'u'},
195 {"invert-match", no_argument, NULL, 'v'},
197 {"word-regexp", no_argument, NULL, 'w'},
198 {"line-regexp", no_argument, NULL, 'x'},
199 {"null-data", no_argument, NULL, 'z'},
221 if (len > 0 && pat[len - 1] == '\n') in add_pattern()
222 --len; in add_pattern()
223 /* pat may not be NUL-terminated */ in add_pattern()
279 if (strcmp(fn, "-") == 0) in read_patterns()
283 if ((fstat(fileno(f), &st) == -1) || (S_ISDIR(st.st_mode))) { in read_patterns()
289 while ((rlen = getline(&line, &len, f)) != -1) { in read_patterns()
298 if (strcmp(fn, "-") != 0) in read_patterns()
385 -1)) {
391 else if (Aflag > LLONG_MAX / 10 - 1) {
396 Aflag = Bflag = (Aflag * 10) + (c - '0');
416 err(2, "context argument must be non-negative");
441 errx(2, errstr[2], "--devices");
452 errx(2, errstr[2], "--directories");
567 else if (strcasecmp("without-match", optarg) == 0)
572 errx(2, errstr[2], "--binary-files");
578 strcasecmp("if-tty", optarg) == 0) {
592 errx(2, errstr[2], "--color");
628 aargc -= optind;
646 --aargc;
655 * regex(3) implementations that support fixed-string searches generally
704 exit(!procfile("-"));
709 for (matched = false; aargc--; ++aargv) {