Gavin Smith wrote:
> In info.c the file name is printed with a simple printf:
> 
>             printf ("%s\n", ref_list[i]->filename);
> 
> We don't deal with line endings or "text mode" at all here - just
> printing a string to stdout in the most straightforward way.
> 
> It appears that there is some disconnect between the compiler and
> grep on mingw-w64.

Yes. The compiler's runtime prints a newline as <CR><LF> by default,
where the 'grep' program is POSIX-compliant (no special handling of CR/LF).

> hello | grep 'world$'
> 
> would fail?

Yes, it does:

$ ./hello | od -t c
0000000   H   e   l   l   o       w   o   r   l   d  \r  \n
0000015

> Yes but I'd rather not complicate the code to deal with <CR>s.

OK; that's a different approach to testing than the one I use.

In my packages, I assume a POSIX-compliant environment (grep, awk, etc.)
and filter out CRs *only* from the output of the programs that are part
of my package.

It is also possible to do like Eli does: Use special mingw versions of
the tools (grep, awk, etc.). I believe that in this case you globally
have to handle fewer CRLF problems, but you have them also in other
places than the output of your own programs.

Bruno




Reply via email to