Re: strncpy clarify result may not be null terminated

DJ Delorie
2023-11-08T19:59:12Z

Perhaps an example that shows the problem?

EXAMPLES

strncpy (buf, "1", 5);
{ '1', 0, 0, 0, 0 }

strncpy (buf, "1234", 5);
{ '1', '2', '3', '4', 0 }

strncpy (buf, "12345", 5);
{ '1', '2', '3', '4', '5' }

strncpy (buf, "123456", 5);
{ '1', '2', '3', '4', '5' }

Maybe strcpy and strncpy shouldn't even share man pages, since they're
not as related as we once thought?