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 02:35:53 +0700
Robert Elz <kre%munnari.OZ.AU@localhost> wrote:
> You changed the behaviour in the case of over-long lines, but
> arguably to a more rational failure (or weirdness) mode than the current
> comm, so that's probably OK (the man page says nothing about a max line
> length, I have no idea if posix does or not). To change back, make
> getnextln() a wrapper around fgets() that removes the final \n if it
> is there, rather than a fgetc() loop, but I think it is better as you have it
> (of course, better still would be to remove the limit, but that's not
> nearly so easy.)
I have code (http://www.druid.net/~darcy/files/getline.c) that does
this. Be gentle. That code is older than some of the people I work
with. :-)
> I'd use a tab, rather than spaces, before the local var declarations
> in the new getnextln() function, to be consistent with the rest of
> what is in the source.
Yes and I also changed another line to have consistient braceage. I
also used size_t instead of int for the line length.
> Aside from that, the fix is clearly correct, so I'm not sure there's
> any need to wait.
I made the changes pretty late at night so I wanted to look at it again
in the light of day. :-)
--
D'Arcy J.M. Cain <darcy%NetBSD.org@localhost>
http://www.NetBSD.org/
Home |
Main Index |
Thread Index |
Old Index