grep: Change match any pattern to "^"

This commit is contained in:
sin 2016-01-20 17:26:47 +00:00
parent 0e9eee4fa3
commit 0d955d3f23

2
grep.c
View File

@ -50,7 +50,7 @@ addpattern(const char *pattern, size_t patlen)
/* a null BRE/ERE matches every line */ /* a null BRE/ERE matches every line */
if (!Fflag) if (!Fflag)
if (pattern[0] == '\0') if (pattern[0] == '\0')
pattern = "."; pattern = "^";
if (!Fflag && xflag) { if (!Fflag && xflag) {
tmp = enmalloc(Error, patlen + 3); tmp = enmalloc(Error, patlen + 3);