BUF_DUP(3) - Library Functions Manual

NAME

buf_dup - duplicate a string buffer

SYNOPSIS

#include <buf.h>

int
buf_dup(struct buf *b, const struct buf *src);

DESCRIPTION

The pointer b must not contain data as it will be overriden and may be let unchanged as-is.

RETURN VALUE

If the src buffer isn’t initialized (and contains a NULL data field) the destination buffer b is unchanged but the function returns 0.

Otherwise the buf_dup() function returns -1 in case of error and errno is set to indicate the error.

ERRORS

[ENOMEM]

There wasn’t enough memory to duplicate the buffer.

SEE ALSO

libbuf(3)

AUTHORS

The libbuf library was written by David Demelier <markand@malikania.fr>

macOS 13.5 - October 29, 2019-2022