Here is a diff from Joachim Wiberg's version of mg. "The strlcpy() function is guaranteed to never copy more than 'len - 1' bytes, so there is no need to check if we copied more. This is a bogus warning since the introduction of strlcpy()."
Tested and seems reasonable. ok? Index: cinfo.c =================================================================== RCS file: /cvs/src/usr.bin/mg/cinfo.c,v retrieving revision 1.18 diff -u -p -r1.18 cinfo.c --- cinfo.c 19 Mar 2015 21:22:15 -0000 1.18 +++ cinfo.c 9 Mar 2021 20:09:54 -0000 @@ -106,7 +106,6 @@ char * getkeyname(char *cp, size_t len, int k) { const char *np; - size_t copied; if (k < 0) k = CHARMASK(k); /* sign extended char */ @@ -151,8 +150,6 @@ getkeyname(char *cp, size_t len, int k) *cp = '\0'; return (cp); } - copied = strlcpy(cp, np, len); - if (copied >= len) - copied = len - 1; - return (cp + copied); + + return (cp + strlcpy(cp, np, len)); }