openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libnl/1_3.4.0-r0/libnl-3.4.0/lib/attr.c
size_t nla_strlcpy(char* dst, const struct nlattr* nla, size_t dstsize)
{
    size_t srclen = nla_len(nla);
    const char* src = 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.
 * @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 .
size_t nla_strlcpy(char* dst, const struct nlattr* nla, size_t dstsize)
{
    size_t srclen = nla_len(nla);
    const char* src = 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;
}
size_t nla_strlcpy ( char * dst , const struct nlattr * nla , size_t dstsize ) { size_t srclen = nla_len ( nla ) ; const char * src = 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 .