This is a common misconception about strncat().
Strncpy() and strncat() behave non-orthogonal.
strncpy(a, b, n): copy at most n characters from b to a; zerofil remainder.
NUL termination not guaranteed.
typical usage:
strncpy(a,b,sizeofa-1);
a[n-1] = '\0';
strncat(a,b,n): append at most n characters from b to a; then add NUL byte.
Typical usage:
strncat(a,b, sizeofa - strlen(a) - 1);
(It can be argued that atmost n bytes are appended to a, as the
trailing NUL byte of a is overwritten)
Yep, standards are that warped.
Casper