1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
23 * A merge of Bjorn Reese's format() function and Daniel's dsprintf()
24 * 1.0. A full blooded printf() clone with full support for <num>$
25 * everywhere (parameters, widths and precisions) including variabled
26 * sized parameters (like doubles, long longs, long doubles and even
27 * void * in 64-bit architectures).
29 * Current restrictions:
30 * - Max 128 parameters
31 * - No 'long double' support.
33 * If you ever want truly portable and good *printf() clones, the project that
34 * took on from here is named 'Trio' and you find more details on the trio web
35 * page at https://daniel.haxx.se/projects/trio/
38 #include "curl_setup.h"
39 #include <curl/mprintf.h>
41 #include "curl_memory.h"
42 /* The last #include file should be: */
45 #ifndef SIZEOF_LONG_DOUBLE
46 #define SIZEOF_LONG_DOUBLE 0
50 * If SIZEOF_SIZE_T has not been defined, default to the size of long.
54 # define SIZEOF_SIZE_T CURL_SIZEOF_LONG
58 # define LONG_LONG_TYPE long long
59 # define HAVE_LONG_LONG_TYPE
61 # if defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
62 # define LONG_LONG_TYPE __int64
63 # define HAVE_LONG_LONG_TYPE
65 # undef LONG_LONG_TYPE
66 # undef HAVE_LONG_LONG_TYPE
71 * Non-ANSI integer extensions
74 #if (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) || \
75 (defined(__WATCOMC__) && defined(__386__)) || \
76 (defined(__POCC__) && defined(_MSC_VER)) || \
77 (defined(_WIN32_WCE)) || \
78 (defined(__MINGW32__)) || \
79 (defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64))
80 # define MP_HAVE_INT_EXTENSIONS
84 * Max integer data types that mprintf.c is capable
87 #ifdef HAVE_LONG_LONG_TYPE
88 # define mp_intmax_t LONG_LONG_TYPE
89 # define mp_uintmax_t unsigned LONG_LONG_TYPE
91 # define mp_intmax_t long
92 # define mp_uintmax_t unsigned long
95 #define BUFFSIZE 326 /* buffer for long-to-str and float-to-str calcs, should
96 fit negative DBL_MAX (317 letters) */
97 #define MAX_PARAMETERS 128 /* lame static limit */
103 /* Lower-case digits. */
104 static const char lower_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
106 /* Upper-case digits. */
107 static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
111 if(stream((unsigned char)(x), (FILE *)data) != -1) \
114 return done; /* return immediately on failure */ \
117 /* Data type to read from the arglist */
128 FORMAT_WIDTH /* For internal use */
131 /* conversion and display flags */
135 FLAGS_SHOWSIGN = 1<<1,
140 FLAGS_LONGLONG = 1<<6,
141 FLAGS_LONGDOUBLE = 1<<7,
142 FLAGS_PAD_NIL = 1<<8,
143 FLAGS_UNSIGNED = 1<<9,
147 FLAGS_WIDTH = 1<<13, /* '*' or '*<num>$' used */
148 FLAGS_WIDTHPARAM = 1<<14, /* width PARAMETER was specified */
149 FLAGS_PREC = 1<<15, /* precision was specified */
150 FLAGS_PRECPARAM = 1<<16, /* precision PARAMETER was specified */
151 FLAGS_CHAR = 1<<17, /* %c story */
152 FLAGS_FLOATE = 1<<18, /* %e or %E */
153 FLAGS_FLOATG = 1<<19 /* %g or %G */
159 long width; /* width OR width parameter number */
160 long precision; /* precision OR precision parameter number */
165 mp_intmax_t as_signed;
166 mp_uintmax_t as_unsigned;
179 char *buffer; /* allocated buffer */
180 size_t len; /* length of string */
181 size_t alloc; /* length of alloc */
182 int fail; /* (!= 0) if an alloc has failed and thus
183 the output is not the complete data */
186 static long dprintf_DollarString(char *input, char **end)
189 while(ISDIGIT(*input)) {
191 number += *input-'0';
194 if(number && ('$'==*input++)) {
201 static bool dprintf_IsQualifierNoDollar(const char *fmt)
203 #if defined(MP_HAVE_INT_EXTENSIONS)
204 if(!strncmp(fmt, "I32", 3) || !strncmp(fmt, "I64", 3)) {
210 case '-': case '+': case ' ': case '#': case '.':
211 case '0': case '1': case '2': case '3': case '4':
212 case '5': case '6': case '7': case '8': case '9':
213 case 'h': case 'l': case 'L': case 'z': case 'q':
215 #if defined(MP_HAVE_INT_EXTENSIONS)
225 /******************************************************************
228 * Create an index with the type of each parameter entry and its
229 * value (may vary in size)
231 * Returns zero on success.
233 ******************************************************************/
235 static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,
238 char *fmt = (char *)format;
251 continue; /* while */
256 /* Handle the positional case (N$) */
260 this_param = dprintf_DollarString(fmt, &fmt);
262 /* we got no positional, get the next counter */
263 this_param = param_num;
265 if(this_param > max_param)
266 max_param = this_param;
269 * The parameter with number 'i' should be used. Next, we need
270 * to get SIZE and TYPE of the parameter. Add the information
277 /* Handle the flags */
279 while(dprintf_IsQualifierNoDollar(fmt)) {
280 #if defined(MP_HAVE_INT_EXTENSIONS)
281 if(!strncmp(fmt, "I32", 3)) {
285 else if(!strncmp(fmt, "I64", 3)) {
286 flags |= FLAGS_LONGLONG;
294 flags |= FLAGS_SPACE;
297 flags |= FLAGS_SHOWSIGN;
301 flags &= ~FLAGS_PAD_NIL;
308 /* The precision is picked from a specified parameter */
310 flags |= FLAGS_PRECPARAM;
314 i = dprintf_DollarString(fmt, &fmt);
318 precision = param_num;
320 if(precision > max_param)
321 max_param = precision;
325 precision = strtol(fmt, &fmt, 10);
329 flags |= FLAGS_SHORT;
331 #if defined(MP_HAVE_INT_EXTENSIONS)
333 #if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
334 flags |= FLAGS_LONGLONG;
341 if(flags & FLAGS_LONG)
342 flags |= FLAGS_LONGLONG;
347 flags |= FLAGS_LONGDOUBLE;
350 flags |= FLAGS_LONGLONG;
353 /* the code below generates a warning if -Wunreachable-code is
355 #if (SIZEOF_SIZE_T > CURL_SIZEOF_LONG)
356 flags |= FLAGS_LONGLONG;
362 #if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
363 flags |= FLAGS_LONGLONG;
369 if(!(flags & FLAGS_LEFT))
370 flags |= FLAGS_PAD_NIL;
372 case '1': case '2': case '3': case '4':
373 case '5': case '6': case '7': case '8': case '9':
374 flags |= FLAGS_WIDTH;
375 width = strtol(fmt-1, &fmt, 10);
377 case '*': /* Special case */
378 flags |= FLAGS_WIDTHPARAM;
381 i = dprintf_DollarString(fmt, &fmt);
386 if(width > max_param)
394 /* Handle the specifier */
398 if((i < 0) || (i >= MAX_PARAMETERS))
399 /* out of allowed range */
407 vto[i].type = FORMAT_STRING;
410 vto[i].type = FORMAT_INTPTR;
413 vto[i].type = FORMAT_PTR;
416 vto[i].type = FORMAT_INT;
419 vto[i].type = FORMAT_INT;
420 flags |= FLAGS_UNSIGNED;
423 vto[i].type = FORMAT_INT;
424 flags |= FLAGS_OCTAL;
427 vto[i].type = FORMAT_INT;
428 flags |= FLAGS_HEX|FLAGS_UNSIGNED;
431 vto[i].type = FORMAT_INT;
432 flags |= FLAGS_HEX|FLAGS_UPPER|FLAGS_UNSIGNED;
435 vto[i].type = FORMAT_INT;
439 vto[i].type = FORMAT_DOUBLE;
442 vto[i].type = FORMAT_DOUBLE;
443 flags |= FLAGS_FLOATE;
446 vto[i].type = FORMAT_DOUBLE;
447 flags |= FLAGS_FLOATE|FLAGS_UPPER;
450 vto[i].type = FORMAT_DOUBLE;
451 flags |= FLAGS_FLOATG;
454 vto[i].type = FORMAT_DOUBLE;
455 flags |= FLAGS_FLOATG|FLAGS_UPPER;
458 vto[i].type = FORMAT_UNKNOWN;
462 vto[i].flags = flags;
463 vto[i].width = width;
464 vto[i].precision = precision;
466 if(flags & FLAGS_WIDTHPARAM) {
467 /* we have the width specified from a parameter, so we make that
468 parameter's info setup properly */
471 vto[k].type = FORMAT_WIDTH;
472 vto[k].flags = FLAGS_NEW;
473 /* can't use width or precision of width! */
475 vto[k].precision = 0;
477 if(flags & FLAGS_PRECPARAM) {
478 /* we have the precision specified from a parameter, so we make that
479 parameter's info setup properly */
480 long k = precision - 1;
481 vto[i].precision = k;
482 vto[k].type = FORMAT_WIDTH;
483 vto[k].flags = FLAGS_NEW;
484 /* can't use width or precision of width! */
486 vto[k].precision = 0;
488 *endpos++ = fmt + 1; /* end of this sequence */
492 /* Read the arg list parameters into our data list */
493 for(i=0; i<max_param; i++) {
494 /* Width/precision arguments must be read before the main argument
495 they are attached to */
496 if(vto[i].flags & FLAGS_WIDTHPARAM) {
497 vto[vto[i].width].data.num.as_signed =
498 (mp_intmax_t)va_arg(arglist, int);
500 if(vto[i].flags & FLAGS_PRECPARAM) {
501 vto[vto[i].precision].data.num.as_signed =
502 (mp_intmax_t)va_arg(arglist, int);
505 switch(vto[i].type) {
507 vto[i].data.str = va_arg(arglist, char *);
513 vto[i].data.ptr = va_arg(arglist, void *);
517 #ifdef HAVE_LONG_LONG_TYPE
518 if((vto[i].flags & FLAGS_LONGLONG) && (vto[i].flags & FLAGS_UNSIGNED))
519 vto[i].data.num.as_unsigned =
520 (mp_uintmax_t)va_arg(arglist, mp_uintmax_t);
521 else if(vto[i].flags & FLAGS_LONGLONG)
522 vto[i].data.num.as_signed =
523 (mp_intmax_t)va_arg(arglist, mp_intmax_t);
527 if((vto[i].flags & FLAGS_LONG) && (vto[i].flags & FLAGS_UNSIGNED))
528 vto[i].data.num.as_unsigned =
529 (mp_uintmax_t)va_arg(arglist, unsigned long);
530 else if(vto[i].flags & FLAGS_LONG)
531 vto[i].data.num.as_signed =
532 (mp_intmax_t)va_arg(arglist, long);
533 else if(vto[i].flags & FLAGS_UNSIGNED)
534 vto[i].data.num.as_unsigned =
535 (mp_uintmax_t)va_arg(arglist, unsigned int);
537 vto[i].data.num.as_signed =
538 (mp_intmax_t)va_arg(arglist, int);
543 vto[i].data.dnum = va_arg(arglist, double);
547 /* Argument has been read. Silently convert it into an integer
550 vto[i].type = FORMAT_INT;
562 static int dprintf_formatf(
563 void *data, /* untouched by format(), just sent to the stream() function in
564 the second argument */
565 /* function pointer called for each output character */
566 int (*stream)(int, FILE *),
567 const char *format, /* %-formatted string */
568 va_list ap_save) /* list of parameters */
570 /* Base-36 digits for numbers. */
571 const char *digits = lower_digits;
573 /* Pointer into the format string. */
576 /* Number of characters written. */
579 long param; /* current parameter to read */
580 long param_num=0; /* parameter counter */
582 va_stack_t vto[MAX_PARAMETERS];
583 char *endpos[MAX_PARAMETERS];
590 /* 'workend' points to the final buffer byte position, but with an extra
591 byte as margin to avoid the (false?) warning Coverity gives us
593 char *workend = &work[sizeof(work) - 2];
595 /* Do the actual %-code parsing */
596 if(dprintf_Pass1(format, vto, endpos, ap_save))
599 end = &endpos[0]; /* the initial end-position from the list dprintf_Pass1()
604 /* Format spec modifiers. */
607 /* Width of a field. */
610 /* Precision of a field. */
613 /* Decimal integer is negative. */
616 /* Base of a number to be written. */
619 /* Integral values to be written. */
622 /* Used to convert negative in positive. */
623 mp_intmax_t signed_num;
628 /* This isn't a format spec, so write everything out until the next one
629 OR end of string is reached. */
632 } while(*++f && ('%' != *f));
638 /* Check for "%%". Note that although the ANSI standard lists
639 '%' as a conversion specifier, it says "The complete format
640 specification shall be `%%'," so we can avoid all the width
641 and precision processing. */
648 /* If this is a positional parameter, the position must follow immediately
649 after the %, thus create a %<num>$ sequence */
650 param=dprintf_DollarString(f, &f);
657 param_num++; /* increase this always to allow "%2$s %1$s %s" and then the
658 third %s will pick the 3rd argument */
662 /* pick up the specified width */
663 if(p->flags & FLAGS_WIDTHPARAM) {
664 width = (long)vto[p->width].data.num.as_signed;
665 param_num++; /* since the width is extracted from a parameter, we
666 must skip that to get to the next one properly */
668 /* "A negative field width is taken as a '-' flag followed by a
669 positive field width." */
671 p->flags |= FLAGS_LEFT;
672 p->flags &= ~FLAGS_PAD_NIL;
678 /* pick up the specified precision */
679 if(p->flags & FLAGS_PRECPARAM) {
680 prec = (long)vto[p->precision].data.num.as_signed;
681 param_num++; /* since the precision is extracted from a parameter, we
682 must skip that to get to the next one properly */
684 /* "A negative precision is taken as if the precision were
688 else if(p->flags & FLAGS_PREC)
693 is_alt = (p->flags & FLAGS_ALT) ? 1 : 0;
697 num = p->data.num.as_unsigned;
698 if(p->flags & FLAGS_CHAR) {
700 if(!(p->flags & FLAGS_LEFT))
704 if(p->flags & FLAGS_LEFT)
709 if(p->flags & FLAGS_OCTAL) {
710 /* Octal unsigned integer. */
712 goto unsigned_number;
714 else if(p->flags & FLAGS_HEX) {
715 /* Hexadecimal unsigned integer. */
717 digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits;
719 goto unsigned_number;
721 else if(p->flags & FLAGS_UNSIGNED) {
722 /* Decimal unsigned integer. */
724 goto unsigned_number;
727 /* Decimal integer. */
730 is_neg = (p->data.num.as_signed < (mp_intmax_t)0) ? 1 : 0;
732 /* signed_num might fail to hold absolute negative minimum by 1 */
733 signed_num = p->data.num.as_signed + (mp_intmax_t)1;
734 signed_num = -signed_num;
735 num = (mp_uintmax_t)signed_num;
736 num += (mp_uintmax_t)1;
742 /* Unsigned number of base BASE. */
746 /* Number of base BASE. */
748 /* Supply a default precision if none was given. */
752 /* Put the number in WORK. */
755 *w-- = digits[num % base];
758 width -= (long)(workend - w);
759 prec -= (long)(workend - w);
761 if(is_alt && base == 8 && prec <= 0) {
772 if(is_alt && base == 16)
775 if(is_neg || (p->flags & FLAGS_SHOWSIGN) || (p->flags & FLAGS_SPACE))
778 if(!(p->flags & FLAGS_LEFT) && !(p->flags & FLAGS_PAD_NIL))
784 else if(p->flags & FLAGS_SHOWSIGN)
786 else if(p->flags & FLAGS_SPACE)
789 if(is_alt && base == 16) {
791 if(p->flags & FLAGS_UPPER)
797 if(!(p->flags & FLAGS_LEFT) && (p->flags & FLAGS_PAD_NIL))
801 /* Write the number. */
802 while(++w <= workend) {
806 if(p->flags & FLAGS_LEFT)
814 static const char null[] = "(nil)";
818 str = (char *) p->data.str;
820 /* Write null[] if there's space. */
821 if(prec == -1 || prec >= (long) sizeof(null) - 1) {
823 len = sizeof(null) - 1;
824 /* Disable quotes around (nil) */
825 p->flags &= (~FLAGS_ALT);
837 width -= (len > LONG_MAX) ? LONG_MAX : (long)len;
839 if(p->flags & FLAGS_ALT)
842 if(!(p->flags&FLAGS_LEFT))
846 while((len-- > 0) && *str)
848 if(p->flags&FLAGS_LEFT)
852 if(p->flags & FLAGS_ALT)
858 /* Generic pointer. */
861 ptr = (void *) p->data.ptr;
863 /* If the pointer is not NULL, write it as a %#x spec. */
865 digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits;
872 /* Write "(nil)" for a nil pointer. */
873 static const char strnil[] = "(nil)";
876 width -= (long)(sizeof(strnil) - 1);
877 if(p->flags & FLAGS_LEFT)
880 for(point = strnil; *point != '\0'; ++point)
882 if(! (p->flags & FLAGS_LEFT))
891 char formatbuf[32]="%";
892 char *fptr = &formatbuf[1];
893 size_t left = sizeof(formatbuf)-strlen(formatbuf);
897 if(p->flags & FLAGS_WIDTH)
899 else if(p->flags & FLAGS_WIDTHPARAM)
900 width = (long)vto[p->width].data.num.as_signed;
903 if(p->flags & FLAGS_PREC)
905 else if(p->flags & FLAGS_PRECPARAM)
906 prec = (long)vto[p->precision].data.num.as_signed;
908 if(p->flags & FLAGS_LEFT)
910 if(p->flags & FLAGS_SHOWSIGN)
912 if(p->flags & FLAGS_SPACE)
914 if(p->flags & FLAGS_ALT)
920 if(width >= (long)sizeof(work))
921 width = sizeof(work)-1;
922 /* RECURSIVE USAGE */
923 len = curl_msnprintf(fptr, left, "%ld", width);
928 /* for each digit in the integer part, we can have one less
930 size_t maxprec = sizeof(work) - 2;
931 double val = p->data.dnum;
937 if(prec > (long)maxprec)
938 prec = (long)maxprec-1;
939 /* RECURSIVE USAGE */
940 len = curl_msnprintf(fptr, left, ".%ld", prec);
943 if(p->flags & FLAGS_LONG)
946 if(p->flags & FLAGS_FLOATE)
947 *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'E':'e');
948 else if(p->flags & FLAGS_FLOATG)
949 *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'G' : 'g');
953 *fptr = 0; /* and a final zero termination */
955 /* NOTE NOTE NOTE!! Not all sprintf implementations return number of
957 (sprintf)(work, formatbuf, p->data.dnum);
959 assert(strlen(work) <= sizeof(work));
961 for(fptr=work; *fptr; fptr++)
967 /* Answer the count of characters written. */
968 #ifdef HAVE_LONG_LONG_TYPE
969 if(p->flags & FLAGS_LONGLONG)
970 *(LONG_LONG_TYPE *) p->data.ptr = (LONG_LONG_TYPE)done;
973 if(p->flags & FLAGS_LONG)
974 *(long *) p->data.ptr = (long)done;
975 else if(!(p->flags & FLAGS_SHORT))
976 *(int *) p->data.ptr = (int)done;
978 *(short *) p->data.ptr = (short)done;
984 f = *end++; /* goto end of %-code */
990 /* fputc() look-alike */
991 static int addbyter(int output, FILE *data)
993 struct nsprintf *infop=(struct nsprintf *)data;
994 unsigned char outc = (unsigned char)output;
996 if(infop->length < infop->max) {
997 /* only do this if we haven't reached max length yet */
998 infop->buffer[0] = outc; /* store */
999 infop->buffer++; /* increase pointer */
1000 infop->length++; /* we are now one byte larger */
1001 return outc; /* fputc() returns like this on success */
1006 int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,
1010 struct nsprintf info;
1012 info.buffer = buffer;
1014 info.max = maxlength;
1016 retcode = dprintf_formatf(&info, addbyter, format, ap_save);
1017 if((retcode != -1) && info.max) {
1018 /* we terminate this with a zero byte */
1019 if(info.max == info.length)
1020 /* we're at maximum, scrap the last letter */
1021 info.buffer[-1] = 0;
1028 int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...)
1031 va_list ap_save; /* argument pointer */
1032 va_start(ap_save, format);
1033 retcode = curl_mvsnprintf(buffer, maxlength, format, ap_save);
1038 /* fputc() look-alike */
1039 static int alloc_addbyter(int output, FILE *data)
1041 struct asprintf *infop=(struct asprintf *)data;
1042 unsigned char outc = (unsigned char)output;
1044 if(!infop->buffer) {
1045 infop->buffer = malloc(32);
1046 if(!infop->buffer) {
1048 return -1; /* fail */
1053 else if(infop->len+1 >= infop->alloc) {
1054 char *newptr = NULL;
1055 size_t newsize = infop->alloc*2;
1057 /* detect wrap-around or other overflow problems */
1058 if(newsize > infop->alloc)
1059 newptr = realloc(infop->buffer, newsize);
1063 return -1; /* fail */
1065 infop->buffer = newptr;
1066 infop->alloc = newsize;
1069 infop->buffer[ infop->len ] = outc;
1073 return outc; /* fputc() returns like this on success */
1076 char *curl_maprintf(const char *format, ...)
1078 va_list ap_save; /* argument pointer */
1080 struct asprintf info;
1087 va_start(ap_save, format);
1088 retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
1090 if((-1 == retcode) || info.fail) {
1096 info.buffer[info.len] = 0; /* we terminate this with a zero byte */
1103 char *curl_mvaprintf(const char *format, va_list ap_save)
1106 struct asprintf info;
1113 retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
1114 if((-1 == retcode) || info.fail) {
1121 info.buffer[info.len] = 0; /* we terminate this with a zero byte */
1128 static int storebuffer(int output, FILE *data)
1130 char **buffer = (char **)data;
1131 unsigned char outc = (unsigned char)output;
1134 return outc; /* act like fputc() ! */
1137 int curl_msprintf(char *buffer, const char *format, ...)
1139 va_list ap_save; /* argument pointer */
1141 va_start(ap_save, format);
1142 retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
1144 *buffer=0; /* we terminate this with a zero byte */
1148 int curl_mprintf(const char *format, ...)
1151 va_list ap_save; /* argument pointer */
1152 va_start(ap_save, format);
1154 retcode = dprintf_formatf(stdout, fputc, format, ap_save);
1159 int curl_mfprintf(FILE *whereto, const char *format, ...)
1162 va_list ap_save; /* argument pointer */
1163 va_start(ap_save, format);
1164 retcode = dprintf_formatf(whereto, fputc, format, ap_save);
1169 int curl_mvsprintf(char *buffer, const char *format, va_list ap_save)
1172 retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
1173 *buffer=0; /* we terminate this with a zero byte */
1177 int curl_mvprintf(const char *format, va_list ap_save)
1179 return dprintf_formatf(stdout, fputc, format, ap_save);
1182 int curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save)
1184 return dprintf_formatf(whereto, fputc, format, ap_save);