Current-Users archive

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

Re: Weirdness in comm(1)



On Sat, 28 Nov 2009 18:59:39 +0100
Joerg Sonnenberger <joerg%britannica.bec.de@localhost> wrote:
> On Sat, Nov 28, 2009 at 12:55:56PM -0500, D'Arcy J.M. Cain wrote:
> > I suppose.  It means that we still need a getnextln function in comm.c
> > to handle that.  We can't just call getline directly.
> 
> 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 respectfully disagree.  A line is a line.  A newline is just a marker
that tells us where one line ends and the next one begins.  What would
you think of a sort program that presented you with this output?

a   b   
c   d   
e   f   g       
e   f   
h   i   

Each of those lines ends with a tab.  In fact, what if there was one
more line that ended at the 'i' with no tab and no newline.  How should
it sort?

-- 
D'Arcy J.M. Cain <darcy%NetBSD.org@localhost>
http://www.NetBSD.org/


Home | Main Index | Thread Index | Old Index