From 3d878bfc3ed733ca3b29ecc2ff50a96dfb47ca06 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 30 Dec 2023 23:22:59 +0100 Subject: string: stpecpy -> string_append --- src/string.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/string.h') diff --git a/src/string.h b/src/string.h index 7c16318..e9f2b89 100644 --- a/src/string.h +++ b/src/string.h @@ -8,8 +8,20 @@ #ifndef __STRING_H__ #define __STRING_H__ -/* For details, see string_copying(7). */ -char *stpecpy(char *dst, char *end, const char *src); +/* + * This is an implementation for stpecpy. + * For details, see string_copying(7). + * + * You can safely do something like this: + * + * char buf[128]; + * char *ptr = buf; + * + * ptr = string_append(ptr, buf + 128, "random"); + * ptr = string_append(ptr, buf + 128, "strings"); + * ptr = string_append(ptr, buf + 128, "can be appended safely"); + */ +char *string_append(char *dst, char *end, const char *src); int string_to_int(const char *src, int *result); -- cgit v1.3