summaryrefslogtreecommitdiff
path: root/usr.bin/grep/grep.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-07-02 22:18:04 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-07-02 22:18:04 +0000
commit046db12c08f574744ecb1667c9f620be4edb2cd8 (patch)
treeb1aa5c8900ba0e29aaf52bd79647915c64676845 /usr.bin/grep/grep.c
parent0e0c76b0b9681df1f311463288e4181d8863e2f6 (diff)
Remove the "fast" grep code if SMALL. This has the side effect of breaking
fgrep -w, but oh well. ok deraadt millert
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r--usr.bin/grep/grep.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 184e6fd6b82..d34fd959750 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.41 2010/04/20 15:58:08 jacekm Exp $ */
+/* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -444,13 +444,23 @@ main(int argc, char *argv[])
if (Eflag)
cflags |= REG_EXTENDED;
+ if (Fflag)
+ cflags |= REG_NOSPEC;
+#ifdef SMALL
+ /* Sorry, this won't work */
+ if (Fflag && wflag)
+ errx(1, "Can't use small fgrep with -w");
+#endif
fg_pattern = grep_calloc(patterns, sizeof(*fg_pattern));
r_pattern = grep_calloc(patterns, sizeof(*r_pattern));
for (i = 0; i < patterns; ++i) {
/* Check if cheating is allowed (always is for fgrep). */
+#ifndef SMALL
if (Fflag) {
fgrepcomp(&fg_pattern[i], pattern[i]);
- } else {
+ } else
+#endif
+ {
if (fastcomp(&fg_pattern[i], pattern[i])) {
/* Fall back to full regex library */
c = regcomp(&r_pattern[i], pattern[i], cflags);