bkabrda / rpms / grep

Forked from rpms/grep 6 years ago
Clone
88797f0
--- grep-2.5.1a/src/grep.c.empty-pattern	2006-11-22 19:05:43.000000000 +0000
88797f0
+++ grep-2.5.1a/src/grep.c	2006-11-22 19:22:04.000000000 +0000
88797f0
@@ -1667,9 +1667,6 @@
88797f0
 	  out_invert ^= 1;
88797f0
 	  match_lines = match_words = 0;
88797f0
 	}
88797f0
-      else
88797f0
-	/* Strip trailing newline. */
88797f0
-        --keycc;
88797f0
     }
88797f0
   else
88797f0
     if (optind < argc)
88797f0
--- grep-2.5.1a/src/search.c.empty-pattern	2006-11-22 19:21:11.000000000 +0000
88797f0
+++ grep-2.5.1a/src/search.c	2006-11-22 19:35:06.000000000 +0000
88797f0
@@ -204,6 +204,10 @@
88797f0
       motif = sep;
88797f0
     } while (sep && total != 0);
88797f0
 
88797f0
+  /* Strip trailing newline. */
88797f0
+  if (size && pattern[size - 1] == '\n')
88797f0
+    size--;
88797f0
+
88797f0
   /* In the match_words and match_lines cases, we use a different pattern
88797f0
      for the DFA matcher that will quickly throw out cases that won't work.
88797f0
      Then if DFA succeeds we do some hairy stuff using the regex matcher
88797f0
@@ -288,6 +292,10 @@
88797f0
       motif = sep;
88797f0
     } while (sep && total != 0);
88797f0
 
88797f0
+  /* Strip trailing newline. */
88797f0
+  if (size && pattern[size - 1] == '\n')
88797f0
+    size--;
88797f0
+
88797f0
   /* In the match_words and match_lines cases, we use a different pattern
88797f0
      for the DFA matcher that will quickly throw out cases that won't work.
88797f0
      Then if DFA succeeds we do some hairy stuff using the regex matcher