BUF_SUB(3) - Library Functions Manual
buf_sub - duplicate a specific portion from the buffer
buf_sub(struct buf *b, const struct buf *src, size_t pos, size_t count);
Extract the portion at position pos from the buffer specified by src with count number of characters and set to b.
This function will first initialize and allocate the buffer specified by b to fill the portion length. It should not contain any data because it will be overwritten.
The count argument can be set to -1 to extract data until the end of the src buffer.
Undefined behavior may occur if the pos argument is outside of the buffer bounds.
The buf_sub() function returns false in case of error and errno is set to indicate the error.
Memory allocation failed.
The libbuf library was written by David Demelier <firstname.lastname@example.org>
macOS 11.2 - October 29, 2019-2020