summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorcmiller@zippy.(none) <>2006-05-02 13:55:03 -0400
committercmiller@zippy.(none) <>2006-05-02 13:55:03 -0400
commit4d15fc5ee096fffc6fd36ddcb3c1dea98904c387 (patch)
tree1cc24ca2a9d99f0fe94d42a0e757cfd21f2ca766 /strings
parentb050f975c43fcfa8f85ad9725e6cfe9eff1b025c (diff)
parent0f63c3d39c51d2749bd13c54e68bd48cc04fa300 (diff)
downloadmariadb-git-4d15fc5ee096fffc6fd36ddcb3c1dea98904c387.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
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;