lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
22272347b6
commit
40ab806066
+8
-6
@@ -150,14 +150,16 @@ libshadow_la_SOURCES = \
|
||||
string/sprintf/stpeprintf.h \
|
||||
string/sprintf/xasprintf.c \
|
||||
string/sprintf/xasprintf.h \
|
||||
string/stpecpy.c \
|
||||
string/stpecpy.h \
|
||||
string/strcpy/stpecpy.c \
|
||||
string/strcpy/stpecpy.h \
|
||||
string/strcpy/strncpy.c \
|
||||
string/strcpy/strncpy.h \
|
||||
string/strcpy/strtcpy.c \
|
||||
string/strcpy/strtcpy.h \
|
||||
string/strcpy/zustr2stp.c \
|
||||
string/strcpy/zustr2stp.h \
|
||||
string/strftime.c \
|
||||
string/strftime.h \
|
||||
string/strncpy.h \
|
||||
string/strtcpy.c \
|
||||
string/strtcpy.h \
|
||||
string/zustr2stp.h \
|
||||
strtoday.c \
|
||||
sub.c \
|
||||
subordinateio.h \
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include "getdef.h"
|
||||
#include "prototypes.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include "memzero.h"
|
||||
#include "prototypes.h"
|
||||
#include "string/strftime.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
#define YEAR (365L*DAY)
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <lastlog.h>
|
||||
#include "memzero.h"
|
||||
#include "prototypes.h"
|
||||
#include "string/strncpy.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strncpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined(HAVE_STPECPY)
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#include "string/stpecpy.h"
|
||||
|
||||
|
||||
extern inline char *stpecpy(char *dst, char *end, const char *restrict src);
|
||||
|
||||
|
||||
#endif // !HAVE_STPECPY
|
||||
@@ -0,0 +1,12 @@
|
||||
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "string/strcpy/stpecpy.h"
|
||||
|
||||
|
||||
#if !defined(HAVE_STPECPY)
|
||||
extern inline char *stpecpy(char *dst, char *end, const char *restrict src);
|
||||
#endif
|
||||
@@ -1,18 +1,13 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_STPECPY_H_
|
||||
#define SHADOW_INCLUDE_LIB_STPECPY_H_
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STPECPY_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STPECPY_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined(HAVE_STPECPY)
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
@@ -20,8 +15,10 @@
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
#if !defined(HAVE_STPECPY)
|
||||
ATTR_STRING(3)
|
||||
inline char *stpecpy(char *dst, char *end, const char *restrict src);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -66,6 +63,7 @@ inline char *stpecpy(char *dst, char *end, const char *restrict src);
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(HAVE_STPECPY)
|
||||
inline char *
|
||||
stpecpy(char *dst, char *end, const char *restrict src)
|
||||
{
|
||||
@@ -84,7 +82,7 @@ stpecpy(char *dst, char *end, const char *restrict src)
|
||||
|
||||
return stpcpy(mempcpy(dst, src, dlen), "") + trunc;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // !HAVE_STPECPY
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "string/strcpy/strncpy.h"
|
||||
@@ -0,0 +1,19 @@
|
||||
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STRNCPY_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STRNCPY_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
#define STRNCPY(dst, src) strncpy(dst, src, NITEMS(dst))
|
||||
|
||||
|
||||
#endif // include guard
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023, Alejandro Colomar <alx@kernel.org>
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
@@ -9,9 +7,7 @@
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
extern inline ssize_t strtcpy(char *restrict dst, const char *restrict src,
|
||||
@@ -1,11 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRTCPY_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRTCPY_H_
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STRTCPY_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STRTCPY_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
@@ -16,7 +14,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "defines.h"
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "string/zustr2stp.h"
|
||||
#include "string/strcpy/zustr2stp.h"
|
||||
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRING_ZUSTR2STP_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRING_ZUSTR2STP_H_
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_ZUSTR2STP_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_ZUSTR2STP_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRNCPY_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRNCPY_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
#define STRNCPY(dst, src) strncpy(dst, src, NITEMS(dst))
|
||||
|
||||
|
||||
#endif // include guard
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "defines.h"
|
||||
#include "sizeof.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
#define DAY_TO_STR(str, day) day_to_str(NITEMS(str), str, day)
|
||||
|
||||
+3
-3
@@ -24,9 +24,9 @@
|
||||
|
||||
#include "alloc.h"
|
||||
#include "sizeof.h"
|
||||
#include "string/strncpy.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/zustr2stp.h"
|
||||
#include "string/strcpy/strncpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
#include "string/strcpy/zustr2stp.h"
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
|
||||
+1
-1
@@ -35,8 +35,8 @@
|
||||
#include "shadowio.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
#include "string/strftime.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "time/day_to_str.h"
|
||||
/*@-exitarg@*/
|
||||
#include "exitcodes.h"
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
#include "exitcodes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+2
-1
@@ -31,7 +31,7 @@
|
||||
/*@-exitarg@*/
|
||||
#include "exitcodes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
#ifndef SHELLS_FILE
|
||||
#define SHELLS_FILE "/etc/shells"
|
||||
@@ -43,6 +43,7 @@
|
||||
#define ETCDIR "/etc"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
#include "exitcodes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
#endif
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/stpeprintf.h"
|
||||
#include "string/stpecpy.h"
|
||||
#include "string/strcpy/stpecpy.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -39,8 +39,8 @@
|
||||
#include "exitcodes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
#include "string/strftime.h"
|
||||
#include "string/strtcpy.h"
|
||||
|
||||
|
||||
#ifdef USE_PAM
|
||||
|
||||
+3
-1
@@ -20,7 +20,9 @@
|
||||
#include "prototypes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "sizeof.h"
|
||||
#include "string/zustr2stp.h"
|
||||
#include "string/strcpy/zustr2stp.h"
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
#include "pwio.h"
|
||||
#include "shadowio.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
#include "time/day_to_str.h"
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
#include "exitcodes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -104,7 +104,7 @@ test_strncpy_LDADD = \
|
||||
$(NULL)
|
||||
|
||||
test_strtcpy_SOURCES = \
|
||||
../../lib/string/strtcpy.c \
|
||||
../../lib/string/strcpy/strtcpy.c \
|
||||
test_strtcpy.c \
|
||||
$(NULL)
|
||||
test_strtcpy_CFLAGS = \
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <cmocka.h>
|
||||
|
||||
#include "sizeof.h"
|
||||
#include "string/strncpy.h"
|
||||
#include "string/strcpy/strncpy.h"
|
||||
|
||||
|
||||
static void test_STRNCPY_trunc(void **state);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <cmocka.h>
|
||||
|
||||
#include "sizeof.h"
|
||||
#include "string/strtcpy.h"
|
||||
#include "string/strcpy/strtcpy.h"
|
||||
|
||||
|
||||
static void test_STRTCPY_trunc(void **state);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <stdint.h> // Required by <cmocka.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#include "string/zustr2stp.h"
|
||||
#include "string/strcpy/zustr2stp.h"
|
||||
|
||||
|
||||
static void test_ZUSTR2STP(void **state);
|
||||
|
||||
Reference in New Issue
Block a user