diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-17 17:33:57 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-17 17:33:57 +0300 |
commit | 119b912773e3c41a95f31656ccbd59bbc307c915 (patch) | |
tree | 697334dcab3a9d6a2fa69d7c0b9f77cea9964cb5 /rpmio/rpmstring.h | |
parent | 02939c15fa5441aff46c5f2cbf28086fe67d4d24 (diff) | |
download | librpm-tizen-119b912773e3c41a95f31656ccbd59bbc307c915.tar.gz librpm-tizen-119b912773e3c41a95f31656ccbd59bbc307c915.tar.bz2 librpm-tizen-119b912773e3c41a95f31656ccbd59bbc307c915.zip |
Add rstrlcpy() string helper function
- adopted from strlcpy() function of OpenBSD originally developed by
Todd C. Miller <Todd.Miller@courtesan.com>
Diffstat (limited to 'rpmio/rpmstring.h')
-rw-r--r-- | rpmio/rpmstring.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/rpmio/rpmstring.h b/rpmio/rpmstring.h index 54eeaf1e1..79eaccc03 100644 --- a/rpmio/rpmstring.h +++ b/rpmio/rpmstring.h @@ -125,6 +125,18 @@ char *rstrcat(char **dest, const char *src); char *rstrscat(char **dest, const char *arg, ...) RPM_GNUC_NULL_TERMINATED; /** \ingroup rpmstring + * strlcpy() clone: + * Copy src to string dest of size n. At most n-1 characters + * will be copied. Always zero-terminates (unless n == 0). + * Length of src is returned; if retval >= n, truncation occurred. + * @param dest destination buffer + * @param src string to copy + * @param n destination buffer size + * @return length of src string + */ +size_t rstrlcpy(char *dest, const char *src, size_t n); + +/** \ingroup rpmstring * Split string into fields separated by a character. * @param str string * @param length length of string |