Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/findutils/grep.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1178 by niro, Wed Aug 18 21:56:57 2010 UTC revision 1179 by niro, Wed Dec 15 21:33:41 2010 UTC
# Line 461  static int grep_file(FILE *file) Line 461  static int grep_file(FILE *file)
461   if (found)   if (found)
462   print_line(gl->pattern, strlen(gl->pattern), linenum, ':');   print_line(gl->pattern, strlen(gl->pattern), linenum, ':');
463   } else while (1) {   } else while (1) {
464     unsigned start = gl->matched_range.rm_so;
465   unsigned end = gl->matched_range.rm_eo;   unsigned end = gl->matched_range.rm_eo;
466     unsigned len = end - start;
467   char old = line[end];   char old = line[end];
468   line[end] = '\0';   line[end] = '\0';
469   print_line(line + gl->matched_range.rm_so,   /* Empty match is not printed: try "echo test | grep -o ''" */
470   end - gl->matched_range.rm_so,   if (len != 0)
471   linenum, ':');   print_line(line + start, len, linenum, ':');
472   if (old == '\0')   if (old == '\0')
473   break;   break;
474   line[end] = old;   line[end] = old;
475     if (len == 0)
476     end++;
477  #if !ENABLE_EXTRA_COMPAT  #if !ENABLE_EXTRA_COMPAT
478   if (regexec(&gl->compiled_regex, line + end,   if (regexec(&gl->compiled_regex, line + end,
479   1, &gl->matched_range, REG_NOTBOL) != 0)   1, &gl->matched_range, REG_NOTBOL) != 0)

Legend:
Removed from v.1178  
changed lines
  Added in v.1179