Subject: strncpy vs. strncat
To: None <firstname.lastname@example.org>
From: Andrew Brown <email@example.com>
Date: 02/12/1999 18:15:04
why do the semantics of strncpy and strncat differ?
man strncpy(3) says
The strncpy() copies not more than len characters into dst, appending
`\0' characters if src is less than len characters long, and not termi-
nating dst if src is more than len characters long.
whereas man strncat(3) says
The strncat() function appends not more than count characters.
i recognize that they both refuse to copy more than "len"/"count"
characters, but that implies that strncpy thinks of "len" as the size
of "dst", whereas strncat thinks of "count" as the size of "src".
wouldn't strncat be much better off if it thought the same way as
|-----< "CODE WARRIOR" >-----|
firstname.lastname@example.org * "ah! i see you have the internet
email@example.com (Andrew Brown) that goes *ping*!"
firstname.lastname@example.org * "information is power -- share the wealth."