From 9a9faf86f0a5a301b2c0b56d84288b81f318a55f Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 21 May 2024 12:50:27 +0200 Subject: [PATCH] lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro Signed-off-by: Alejandro Colomar --- lib/Makefile.am | 2 ++ lib/string/strcpy/strncat.c | 7 +++++++ lib/string/strcpy/strncat.h | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 lib/string/strcpy/strncat.c create mode 100644 lib/string/strcpy/strncat.h diff --git a/lib/Makefile.am b/lib/Makefile.am index aaee7167..21900733 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -152,6 +152,8 @@ libshadow_la_SOURCES = \ string/sprintf/xasprintf.h \ string/strcpy/stpecpy.c \ string/strcpy/stpecpy.h \ + string/strcpy/strncat.c \ + string/strcpy/strncat.h \ string/strcpy/strncpy.c \ string/strcpy/strncpy.h \ string/strcpy/strtcpy.c \ diff --git a/lib/string/strcpy/strncat.c b/lib/string/strcpy/strncat.c new file mode 100644 index 00000000..d55f1729 --- /dev/null +++ b/lib/string/strcpy/strncat.c @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include + +#include "string/strcpy/strncat.h" diff --git a/lib/string/strcpy/strncat.h b/lib/string/strcpy/strncat.h new file mode 100644 index 00000000..6bb9907b --- /dev/null +++ b/lib/string/strcpy/strncat.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STRNCAT_H_ +#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STRNCAT_H_ + + +#include + +#include + +#include "sizeof.h" + + +#define STRNCAT(dst, src) strncat(dst, src, NITEMS(src)) + + +#endif // include guard