as mentioned before 'echo aaa | grep -o a' works different in gnu grep
and busybox grep.

attatched patch fixes the issue for ENABLE_EXTRA_COMPAT.

Please consider add it to fixes-1.12.1

-nc
Index: findutils/grep.c
===================================================================
--- findutils/grep.c	(revision 23562)
+++ findutils/grep.c	(working copy)
@@ -363,12 +363,22 @@
 						 * (unless -v: -Fov doesnt print anything at all) */
 						if (found)
 							print_line(gl->pattern, strlen(gl->pattern), linenum, ':');
-					} else {
+					} else while (1) {
+						char old = line[gl->matched_range.rm_eo];
 						line[gl->matched_range.rm_eo] = '\0';
 						print_line(line + gl->matched_range.rm_so,
 								gl->matched_range.rm_eo - gl->matched_range.rm_so,
 								linenum, ':');
-					}
+						line[gl->matched_range.rm_eo] = old;
+#if !ENABLE_EXTRA_COMPAT
+						break;
+#else
+						if (re_search(&gl->compiled_regex, line, line_len,
+								gl->matched_range.rm_eo, line_len - gl->matched_range.rm_eo, 
+								&gl->matched_range) < 0)
+							break;
+#endif
+					} 
 				} else {
 					print_line(line, line_len, linenum, ':');
 				}
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to