[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gawk-devel] Bug with --binary flag
From: |
Aharon Robbins |
Subject: |
Re: [gawk-devel] Bug with --binary flag |
Date: |
Thu, 25 Dec 2008 19:19:47 +0200 |
Steffen,
Hi.
Gawk is not a replacement for cat, so using it on binary data is a bad
idea. The point of -b is to not process character data as multibyte
characters, and that's all. I should perhaps give the option a more
obvious name.
It happens, as you discovered, that this can be more or less made to
work by using RS="\0" and ORS="\0" which uses NUL characters as the
separators, but it's totally unportable: in other awks RS="\0" has the
same effect as RS="", which means something else entirely.
Arnold
> Date: Mon, 22 Dec 2008 23:23:05 +0100
> From: Steffen Schuler <address@hidden>
> To: address@hidden
> Subject: [gawk-devel] Bug with --binary flag
>
> Hi Arnold,
>
> the following bug occured with gawk-devel in the binary mode:
>
> $ ./gawk -v RS= -v ORS= -b '{ print >"/tmp/gawk" } END {
> close("/tmp/gawk") }' /home/steffen/gawk-devel/bin/gawk
> $ cmp /tmp/gawk /home/steffen/gawk-devel/bin/gawk
> /tmp/gawk /home/steffen/gawk-devel/bin/gawk differ: char 292768, line 495
> $
>
> I would have expected at any locale to get equal files.
>
> Regards,
>
> Steffen
>