summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
committersjg <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
commitb137080f19736ee33fede2e88bb54438604cf86b (patch)
tree377ac0ac449528621eb192cd245adadb5fd53668 /usr.bin/grep
parentab21a29eb607d4dfe389b965fbdee27558e791aa (diff)
parent4a8d07956d121238d006d34ffe7d6269744e8b1a (diff)
downloadFreeBSD-src-b137080f19736ee33fede2e88bb54438604cf86b.zip
FreeBSD-src-b137080f19736ee33fede2e88bb54438604cf86b.tar.gz
Merge from head@274682
Diffstat (limited to 'usr.bin/grep')
-rw-r--r--usr.bin/grep/Makefile6
-rw-r--r--usr.bin/grep/regex/tre-fastmatch.c2
-rw-r--r--usr.bin/grep/tests/Makefile41
-rw-r--r--usr.bin/grep/util.c2
4 files changed, 48 insertions, 3 deletions
diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile
index c0c24dc..32941fd 100644
--- a/usr.bin/grep/Makefile
+++ b/usr.bin/grep/Makefile
@@ -11,7 +11,7 @@ PROG= bsdgrep
CLEANFILES+= bsdgrep.1
bsdgrep.1: grep.1
- cp ${.ALLSRC} ${.TARGET}
+ cp -f ${.ALLSRC} ${.TARGET}
.endif
SRCS= file.c grep.c queue.c util.c
@@ -85,4 +85,8 @@ DPADD+= ${LIBGNUREGEX}
CFLAGS+= -DWITHOUT_NLS
.endif
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c
index eddab26..0881c55 100644
--- a/usr.bin/grep/regex/tre-fastmatch.c
+++ b/usr.bin/grep/regex/tre-fastmatch.c
@@ -727,7 +727,7 @@ badpat:
for (unsigned int i = 0; i < fg->len; i++)
if (fg->pattern[i] == '\\')
escaped = !escaped;
- else if (fg->pattern[i] == '.' && escaped)
+ else if (fg->pattern[i] == '.' && fg->escmap && escaped)
{
fg->escmap[i] = true;
escaped = false;
diff --git a/usr.bin/grep/tests/Makefile b/usr.bin/grep/tests/Makefile
new file mode 100644
index 0000000..59b948c
--- /dev/null
+++ b/usr.bin/grep/tests/Makefile
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/grep
+.PATH: ${TESTSRC}
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/usr.bin/grep
+
+ATF_TESTS_SH= grep_test
+ATF_TESTS_SH_SRC_grep_test= t_grep.sh
+
+FILESDIR= ${TESTSDIR}
+FILES= d_basic.out
+FILES+= d_begin_end_a.out
+FILES+= d_begin_end_b.out
+FILES+= d_binary.out
+FILES+= d_context2_a.out
+FILES+= d_context2_b.out
+FILES+= d_context2_c.out
+FILES+= d_context_a.in
+FILES+= d_context_a.out
+FILES+= d_context_b.in
+FILES+= d_context_b.out
+FILES+= d_context_c.out
+FILES+= d_context_d.out
+FILES+= d_egrep.out
+FILES+= d_file_exp.in
+FILES+= d_file_exp.out
+FILES+= d_ignore_case.out
+FILES+= d_input
+FILES+= d_invert.in
+FILES+= d_invert.out
+FILES+= d_recurse.out
+FILES+= d_recurse_symlink.err
+FILES+= d_recurse_symlink.out
+FILES+= d_whole_line.out
+FILES+= d_word_regexps.out
+FILES+= d_zgrep.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 3ec12fa..f3cf05f 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -336,7 +336,7 @@ procline(struct str *l, int nottext)
}
/* One pass if we are not recording matches */
- if (!wflag && ((color == NULL && !oflag) || qflag || lflag))
+ if (!wflag && ((color == NULL && !oflag) || qflag || lflag || Lflag))
break;
if (st == (size_t)pmatch.rm_so)
OpenPOWER on IntegriCloud