Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Weirdness in comm(1)



On Sun, Nov 29, 2009 at 01:42:08AM +0700, Robert Elz wrote:
>     Date:        Sat, 28 Nov 2009 18:59:39 +0100
>     From:        Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
>     Message-ID:  <20091128175939.GA10476%britannica.bec.de@localhost>
> 
>   | Even for the specific case of comm you can't just strip off the
>   | trailling newline. You have to remember if you had one as well and only
>   | compare lines as equal if they either both or none of them has it.
> 
> I'd fix that by having the line getting function used return the number
> of bytes consumed (not necessarily the strlen() of the returned line).
> If the lines compare equal, then compare the lengths, and use that as
> the result.

getline behaves that way. The problem here is that comm needs to compare
the two lines and the newline is not part of the logical line.

Joerg


Home | Main Index | Thread Index | Old Index