PMSTRNCAT(3)

NAME
pmstrncat - safe string concatenation

C SYNOPSIS
#include <pcp/pmapi.h>

int pmstrncat(char *dest, size_t destlen, char *src);

cc ... -lpcp

DESCRIPTION
pmstrncat is safe string concatenation routine with semantics similar to strncat(3).

The main differences are that src must be null-byte terminated, destlen is the length of the destination buffer (dest) not the length of the source string (src), and pmstrncat ensures that dest is null-byte terminated, even when strlen(src) is larger than the remaining space in dest (destlen - strlen(dest) on entry).

On success, pmstrncat returns 0, else -1 indicates that src is too big and the result been truncated to ensure dest has no been overrun.

SEE ALSO
pmstrncpy(3) and strncat(3).