tools/nolibc/string: add strncpy() and strlcpy()
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Feb 2022 16:23:42 +0000 (17:23 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 14 Feb 2022 18:48:54 +0000 (10:48 -0800)
commitff94ad06a0bb29f3e8467a3689be685a05f6d8b4
treeea960dd1735b8ee4be5af6d63d027a2336e7383f
parentfffda88a55763ab63e68034e077531f421fced0f
tools/nolibc/string: add strncpy() and strlcpy()

These are minimal variants. strncpy() always fills the destination for
<size> chars, while strlcpy() copies no more than <size> including the
zero and returns the source's length. The respective sizes on various
archs are:

  strncpy(): x86:0x1f mips:0x30 arm:0x20
  strlcpy(): x86:0x17 mips:0x34 arm:0x1a

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/string.h