diff options
author | 2008-07-14 15:00:58 +0000 | |
---|---|---|
committer | 2008-07-14 15:00:58 +0000 | |
commit | 26b6c2cf16f54b493c4757c099becc0c9ee0b7f3 (patch) | |
tree | 7470a616ba8a1ad070300b89818b57c0d0f0ec06 /src/lib | |
parent | 89675377ca828f07dfeed2042d12c484bf76e49e (diff) |
Fixed popmessage.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/util/astring.c | 37 | ||||
-rw-r--r-- | src/lib/util/astring.h | 7 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/util/astring.c b/src/lib/util/astring.c index 5be6de07a84..5a86d611f89 100644 --- a/src/lib/util/astring.c +++ b/src/lib/util/astring.c @@ -336,6 +336,24 @@ int astring_printf(astring *dst, const char *format, ...) /*------------------------------------------------- + astring_vprintf - vprintf text into an astring +-------------------------------------------------*/ + +int astring_vprintf(astring *dst, const char *format, va_list args) +{ + char tempbuf[4096]; + int result; + + /* sprintf into the temporary buffer */ + result = vsprintf(tempbuf, format, args); + + /* set the result */ + astring_cpyc(dst, tempbuf); + return result; +} + + +/*------------------------------------------------- astring_catprintf - formatted printf to the end of an astring -------------------------------------------------*/ @@ -357,6 +375,25 @@ int astring_catprintf(astring *dst, const char *format, ...) } +/*------------------------------------------------- + astring_catprintf - formatted vprintf to + the end of an astring +-------------------------------------------------*/ + +int astring_catvprintf(astring *dst, const char *format, va_list args) +{ + char tempbuf[4096]; + int result; + + /* sprintf into the temporary buffer */ + result = vsprintf(tempbuf, format, args); + + /* append the result */ + astring_catc(dst, tempbuf); + return result; +} + + /*************************************************************************** ASTRING QUERIES diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h index 2b18bd1182d..3d0c502d886 100644 --- a/src/lib/util/astring.h +++ b/src/lib/util/astring.h @@ -15,6 +15,7 @@ #define __ASTRING_H__ #include "pool.h" +#include <stdarg.h> /*************************************************************************** @@ -75,9 +76,15 @@ astring *astring_del(astring *str, int start, int count); /* formatted printf to an astring */ int astring_printf(astring *dst, const char *format, ...) ATTR_PRINTF(2,3); +/* formatted vprintf to an astring */ +int astring_vprintf(astring *dst, const char *format, va_list args); + /* formatted printf to the end of an astring */ int astring_catprintf(astring *dst, const char *format, ...) ATTR_PRINTF(2,3); +/* formatted vprintf to the end of an astring */ +int astring_catvprintf(astring *dst, const char *format, va_list args); + /* ----- astring queries ----- */ |