Philip Hazel wrote: > On Wed, 15 Apr 2009, Sheri wrote:
>
>
>> See attached. Includes testtry, testNinput and SLPDiffOut (which has my diff
>> output redirected to file).
>>
>
> Something odd is happening, but I have no idea who is to blame. The
> testNinput file looks OK. It is created by the line
>
> printf "abc\rdef\r\nghi\njkl" >testNinput
>
> Notice that there is no CR after "ghi", just a linefeed. However, in the
> testtry output I see CR LF after "ghi" (I'm looking at the binary bytes
> in each case). So something is changing things...
>
> I wonder, I wonder...
>
> The file is opened in pcregrep with
>
> in = fopen(pathname, "r");
>
> I wonder if it would alter things if instead it was
>
> in = fopen(pathname, "rb");
>
> ? It won't make any difference in Unix/Linux, but it might in your
> environment. I notice that pcretest uses this. Can you try this, please?
>
> Philip
>
> Yes! No more discrepancies.
Suggested enhancement for pcregrep: argument where user can specify the
output separator (defaults to "\n" but could be any string, e.g., "\r\n"
or "Custom string")