Page MenuHomeFreeBSD

D10824.diff
No OneTemporary

D10824.diff

Index: head/usr.bin/grep/grep.h
===================================================================
--- head/usr.bin/grep/grep.h
+++ head/usr.bin/grep/grep.h
@@ -82,7 +82,7 @@
#define EXCL_PAT 0
#define INCL_PAT 1
-#define MAX_LINE_MATCHES 32
+#define MAX_MATCHES 32
struct file {
int fd;
Index: head/usr.bin/grep/grep.c
===================================================================
--- head/usr.bin/grep/grep.c
+++ head/usr.bin/grep/grep.c
@@ -78,7 +78,7 @@
};
/* Flags passed to regcomp() and regexec() */
-int cflags = REG_NOSUB;
+int cflags = REG_NOSUB | REG_NEWLINE;
int eflags = REG_STARTEND;
/* XXX TODO: Get rid of this flag.
Index: head/usr.bin/grep/util.c
===================================================================
--- head/usr.bin/grep/util.c
+++ head/usr.bin/grep/util.c
@@ -61,7 +61,7 @@
* other useful bits
*/
struct parsec {
- regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */
+ regmatch_t matches[MAX_MATCHES]; /* Matches made */
struct str ln; /* Current line */
size_t lnstart; /* Position in line */
size_t matchidx; /* Latest match index */
@@ -295,7 +295,7 @@
/* Print the matching line, but only if not quiet/binary */
if (t == 0 && printmatch) {
printline(&pc, ':');
- while (pc.matchidx >= MAX_LINE_MATCHES) {
+ while (pc.matchidx >= MAX_MATCHES) {
/* Reset matchidx and try again */
pc.matchidx = 0;
if (procline(&pc) == 0)
@@ -401,7 +401,7 @@
lastmatches = 0;
startm = matchidx;
retry = 0;
- if (st > 0)
+ if (st > 0 && pc->ln.dat[st - 1] != fileeol)
leflags |= REG_NOTBOL;
/* Loop to compare with all the patterns */
for (i = 0; i < patterns; i++) {
@@ -483,7 +483,7 @@
}
/* avoid excessive matching - skip further patterns */
if ((color == NULL && !oflag) || qflag || lflag ||
- matchidx >= MAX_LINE_MATCHES) {
+ matchidx >= MAX_MATCHES) {
pc->lnstart = nst;
lastmatches = 0;
break;

File Metadata

Mime Type
text/plain
Expires
Fri, Aug 28, 9:37 PM (5 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37484666
Default Alt Text
D10824.diff (1 KB)

Event Timeline