[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should I worry about NULLs in 7-bit?
< My vote is:
<>- It is nice to have, but an initial version that ignores it is OK
New software should not be written which is "broken" from the outset.
< There is much email software out there written in C which uses:
< fgets() - to read a line
< strlen() - to find its length
< fputs() - to write the line.
< This has the effect of truncating any line at the character preceding the
< first NULL.
Just because other software does it wrong doesn't mean that you have to.
("Why can't I? Everyone else is doing it!" said the 7 year old.)
< This is a consequence of an unfortunate design choice in fgets(). What a
< pity it doesn't return the number of bytes read rather than a pointer to
< the first byte.
No, it's a consequence of not choosing your tools appropriately and using
fgets() where you should have been using some other function. Yes, fgets()
is inadequate for the job of writing email software. So don't use it.
I'm sorry if I sound adamant on this issue, but I've had to go in and fix
the problem too many times.