package/libs/libnl-tiny/src/include/netlink/attr.h
/**
 * Copy string attribute payload to a buffer.
 * @arg dst		Pointer to destination buffer.
 * @arg nla		Attribute of type NLA_STRING.
 * @arg dstsize		Size of destination buffer in bytes.
 *
 * Copies at most dstsize - 1 bytes to the destination buffer.
 * The result is always a valid NUL terminated string. Unlike
 * strlcpy the destination buffer is always padded out.
 *
 * @return The length of string attribute without the terminating NUL.
 */
Copy string attribute payload to a buffer.
@arg dst             Pointer to destination buffer.
@arg nla             Attribute of type NLA_STRING.
@arg dstsize         Size of destination buffer in bytes.

Copies at most dstsize - 1 bytes to the destination buffer.
The result is always a valid NUL terminated string. Unlike
strlcpy the destination buffer is always padded out.

@return The length of string attribute without the terminating NUL.
Copy string attribute payload to a buffer . @arg dst Pointer to destination buffer . @arg nla Attribute of type NLA_STRING . @arg dstsize Size of destination buffer in bytes . Copies at most dstsize - 1 bytes to the destination buffer . The result is always a valid NUL terminated string . Unlike strlcpy the destination buffer is always padded out . @return The length of string attribute without the terminating NUL .
static inline size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
{
	size_t srclen = (size_t)nla_len(nla);
	char *src = (char*)nla_data(nla);
	if (srclen > 0 && src[srclen - 1] == '\0')
		srclen--;
	if (dstsize > 0) {
		size_t len = (srclen >= dstsize) ? dstsize - 1 : srclen;
		memset(dst, 0, dstsize);
		memcpy(dst, src, len);
	}
	return srclen;
}
static inline size_t nla_strlcpy ( char * dst , const struct nlattr * nla , size_t dstsize ) { size_t srclen = ( size_t ) nla_len ( nla ) ; char * src = ( char * ) nla_data ( nla ) ; if ( srclen > 0 && src [ srclen - 1 ] == ' \0 ' ) srclen -- ; if ( dstsize > 0 ) { size_t len = ( srclen >= dstsize ) ? dstsize - 1 : srclen ; memset ( dst , 0 , dstsize ) ; memcpy ( dst , src , len ) ; } return srclen ; }
Copy string attribute payload to a buffer.
Copy string attribute payload to a buffer .