svn commit: trunk/busybox/findutils
vda at busybox.net
vda at busybox.net
Sun Nov 4 00:46:03 UTC 2007
Author: vda
Date: 2007-11-03 17:46:03 -0700 (Sat, 03 Nov 2007)
New Revision: 20358
Log:
grep: fix -Fo
Modified:
trunk/busybox/findutils/grep.c
Changeset:
Modified: trunk/busybox/findutils/grep.c
===================================================================
--- trunk/busybox/findutils/grep.c 2007-11-03 23:18:26 UTC (rev 20357)
+++ trunk/busybox/findutils/grep.c 2007-11-04 00:46:03 UTC (rev 20358)
@@ -174,7 +174,7 @@
while ((line = xmalloc_getline(file)) != NULL) {
llist_t *pattern_ptr = pattern_head;
- grep_list_data_t *gl;
+ grep_list_data_t *gl = gl; /* for gcc */
linenum++;
found = 0;
@@ -274,8 +274,15 @@
print_n_lines_after = lines_after;
#endif
if (option_mask32 & OPT_o) {
- line[regmatch.rm_eo] = '\0';
- print_line(line + regmatch.rm_so, linenum, ':');
+ if (FGREP_FLAG) {
+ /* -Fo just prints the pattern
+ * (unless -v: -Fov doesnt print anything at all) */
+ if (found)
+ print_line(gl->pattern, linenum, ':');
+ } else {
+ line[regmatch.rm_eo] = '\0';
+ print_line(line + regmatch.rm_so, linenum, ':');
+ }
} else {
print_line(line, linenum, ':');
}
More information about the busybox-cvs
mailing list