Re: strlcpy missing on Linux



Nils O. Selåsdal wrote:
Thomas Maier-Komor wrote:
Hi,

does anybody know if there is any specific reason, why Linux's glibc is
missing strlcpy?
Follow the threads at
http://sources.redhat.com/ml/libc-alpha/2000-08/msg00053.html
http://sources.redhat.com/ml/libc-alpha/2002-01/msg00001.html

Thanks. That was a little bit enlightening. I didn't read everything,
but I can say that I totally disagree with the opinion that a program
always has to know how long its strings are.

Reason:
Reading from standard input, you will never be able to determine how
much data you will get. In this case strlcpy can ease the implementation
because it is a) safe, b) tells you when it runs out of memory, c) says
how much has been copied. So it is really convenient to implement an
exception mechanism that supports starting with a small buffer and
increasing it in size when necessary.

But I think this isn't the first time that Linux or glibc developers
know better how to solve problems that they don't have. Very sad.

Tom
.