summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.(none)>2006-05-02 13:55:03 -0400
committerunknown <cmiller@zippy.(none)>2006-05-02 13:55:03 -0400
commitfa5feec0988a07738a6f8121cae8f6e4f9464e00 (patch)
tree1cc24ca2a9d99f0fe94d42a0e757cfd21f2ca766 /strings
parentfb2c04a15f6bb4a837e312019e18f881d43bbdd8 (diff)
parent28d799f1009b50d739e62c43565ecb2cea97450c (diff)
downloadmariadb-git-fa5feec0988a07738a6f8121cae8f6e4f9464e00.tar.gz
Merge zippy.(none):/home/cmiller/work/mysql/mysql-5.0__bug17667
into zippy.(none):/home/cmiller/work/mysql/mysql-5.1-new__bug17667 include/my_sys.h: Auto merged mysys/Makefile.am: Auto merged tests/Makefile.am: Auto merged
Diffstat (limited to 'strings')
-rw-r--r--strings/my_vsnprintf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 0e036c2bbcd..e4302f50c58 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -27,6 +27,7 @@
%#[l]d
%#[l]u
%#[l]x
+ %#.#b Local format; note first # is ignored and second is REQUIRED
%#.#s Note first # is ignored
RETURN
@@ -40,7 +41,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
for (; *fmt ; fmt++)
{
- if (fmt[0] != '%')
+ if (*fmt != '%')
{
if (to == end) /* End of buffer */
break;
@@ -95,6 +96,16 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
to=strnmov(to,par,plen);
continue;
}
+ else if (*fmt == 'b') /* Buffer parameter */
+ {
+ char *par = va_arg(ap, char *);
+ DBUG_ASSERT(to <= end);
+ if (to + abs(width) + 1 > end)
+ width= end - to - 1; /* sign doesn't matter */
+ memmove(to, par, abs(width));
+ to+= width;
+ continue;
+ }
else if (*fmt == 'd' || *fmt == 'u'|| *fmt== 'x') /* Integer parameter */
{
register long larg;