Subject: strncpy vs. strncat
To: None <email@example.com>
From: Andrew Brown <firstname.lastname@example.org>
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" >-----|
email@example.com * "ah! i see you have the internet
firstname.lastname@example.org (Andrew Brown) that goes *ping*!"
email@example.com * "information is power -- share the wealth."