Subject: strncpy vs. strncat
To: None <tech-userlevel@netbsd.org>
From: Andrew Brown <twofsonet@graffiti.com>
List: tech-userlevel
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
strncpy?
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."