aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-15 22:33:02 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-15 22:33:02 +0000
commitf196d285a3a25a99b1dfcab391779ca047364e45 (patch)
tree57e238c52aa2a0479fb069df9351ed3ef2f4fdf3 /include
parentd2478e8f4ff36fb7c548d96868d8803913152e39 (diff)
add ast_build_string library function (from bug #3644)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5684 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/utils.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 5668b316e..5a772b12f 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -185,6 +185,7 @@ extern char *ast_strcasestr(const char *, const char *);
\param dst The destination buffer.
\param src The source string
\param size The size of the destination buffer
+ \return Nothing.
This is similar to \a strncpy, with two important differences:
- the destination buffer will \b always be null-terminated
@@ -193,8 +194,20 @@ extern char *ast_strcasestr(const char *, const char *);
not leave the destination buffer unterminated. There is no need to pass an artificially
reduced buffer size to this function (unlike \a strncpy), and the buffer does not need
to be initialized to zeroes prior to calling this function.
- No return value.
*/
void ast_copy_string(char *dst, const char *src, size_t size);
+/*!
+ \brief Build a string in a buffer, designed to be called repeatedly
+
+ This is a wrapper for snprintf, that properly handles the buffer pointer
+ and buffer space available.
+
+ \return 0 on success, non-zero on failure.
+ \param buffer current position in buffer to place string into (will be updated on return)
+ \param space remaining space in buffer (will be updated on return)
+ \param fmt printf-style format string
+*/
+int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+
#endif /* _ASTERISK_UTILS_H */