GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
GIS Library - GRASS implementation of strlcat(). More...
#include <stddef.h>
#include <string.h>
Go to the source code of this file.
Functions | |
size_t | G_strlcat (char *dst, const char *src, size_t dsize) |
Size-bounded string concatenation. More... | |
GIS Library - GRASS implementation of strlcat().
If available, G_strlcat() calls system strlcat(), otherwise it uses implementation by Todd C. Miller of OpenBSD.
Addition to GRASS GIS by Nicklas Larsson, 2024
Original OpenBSD implementation notes:
Copyright (c) 1998, 2015 Todd C. Miller mille rt@o penbs d.or g
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Definition in file strlcat.c.
size_t G_strlcat | ( | char * | dst, |
const char * | src, | ||
size_t | dsize | ||
) |
Size-bounded string concatenation.
Appends string src to the end of dst. It will append at most dstsize - strlen(dst) - 1 characters. It will then NUL-terminate, unless dstsize is 0 or the original dst string was longer than dstsize (in practice this should not happen as it means that either dstsize is incorrect or that dst is not a proper string).
If the src and dst strings overlap, the behavior is undefined. This function is a safer alternative to strncat.
[out] | dst | Pointer to the destination buffer. Must be a NUL-terminated C string. |
[in] | src | Pointer to the source string, which will be appended. Must be a NUL-terminated C string. |
[in] | dsize | The size of the destination buffer. |