[pcre-dev] [Bug 2680] RunGrepTest Test 132

Kezdőlap
Üzenet törlése
Szerző: admin
Dátum:  
Címzett: pcre-dev
Tárgy: [pcre-dev] [Bug 2680] RunGrepTest Test 132
https://bugs.exim.org/show_bug.cgi?id=2680

--- Comment #1 from Philip Hazel <Philip.Hazel@???> ---
The idea of this test is to check that the standard input is left in the right
place when pcre2grep stops because it has reached the -m limit. The "a" line is
generated by the "head -1" command when run under Linux (which is all I have):

$ (./pcre2grep -m1 -A3 '^match'; echo '---'; head -1) < testdata/grepinput
match 1:
a
match 2:
b
---
a

Looks like this is yet another Linux/BSD difference. Sigh. I think the relevant
code is around line 2589 in pcre2test.c:

  /* If the -m option set a limit for the number of matched or non-matched
  lines, check it here. A limit of zero means that no matching is ever done.
  For stdin from a file, set the file position. */                         


  if (count_limit >= 0 && count_matched_lines >= count_limit)             
    {                                                                   
    if (frtype == FR_PLAIN && filename == stdin_name && !is_file_tty(handle))
      (void)fseek(handle, (long int)filepos, SEEK_SET);             
    rc = (count_limit == 0)? 1 : 0;                                     
    break;                                                             
    }


--
You are receiving this mail because:
You are on the CC list for the bug.