From: Alejandro Colomar Date: Mon, 12 Aug 2024 01:20:46 +0000 (+0200) Subject: lib/io/: fgets_a(): Add macro X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fce315db6d187a2c4cc52a48c00f65a357806fad;p=thirdparty%2Fshadow.git lib/io/: fgets_a(): Add macro Reviewed-by: Iker Pedrosa Signed-off-by: Alejandro Colomar --- diff --git a/lib/Makefile.am b/lib/Makefile.am index 072754819..0257c7605 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -103,6 +103,8 @@ libshadow_la_SOURCES = \ hushed.c \ idmapping.h \ idmapping.c \ + io/fgets/fgets.c \ + io/fgets/fgets.h \ io/syslog.c \ io/syslog.h \ isexpired.c \ diff --git a/lib/io/fgets/fgets.c b/lib/io/fgets/fgets.c new file mode 100644 index 000000000..1d9dec4bf --- /dev/null +++ b/lib/io/fgets/fgets.c @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include "config.h" + +#include "io/fgets/fgets.h" diff --git a/lib/io/fgets/fgets.h b/lib/io/fgets/fgets.h new file mode 100644 index 000000000..5dc27d8e3 --- /dev/null +++ b/lib/io/fgets/fgets.h @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_IO_FGETS_FGETS_H_ +#define SHADOW_INCLUDE_LIB_IO_FGETS_FGETS_H_ + + +#include "config.h" + +#include + +#include "sizeof.h" + + +// fgets_a - FILE get string array-safe +#define fgets_a(buf, stream) fgets(buf, countof(buf), stream) + + +#endif // include guard