Added BIO_vprintf() and BIO_vsnprintf(). The former because I've
authorRichard Levitte <levitte@openssl.org>
Fri, 18 Aug 2000 09:36:59 +0000 (09:36 +0000)
committerRichard Levitte <levitte@openssl.org>
Fri, 18 Aug 2000 09:36:59 +0000 (09:36 +0000)
found myself needing it a number of times, the latter for completeness.

CHANGES
crypto/bio/b_print.c
crypto/bio/bio.h

diff --git a/CHANGES b/CHANGES
index 078c2b6a0d670425175e61bb6fde505dc621edd2..853fe0e1f3b04b7de9ed0b7092065e69900fd9f8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
+  *) Added BIO_vprintf() and BIO_vsnprintf().
+     [Richard Levitte]
+
   *) Added more prefixes to parse for in the the strings written
      through a logging bio, to cover all the levels that are available
      through syslog.  The prefixes are now:
   *) Added more prefixes to parse for in the the strings written
      through a logging bio, to cover all the levels that are available
      through syslog.  The prefixes are now:
index aafa85bd12a55070805bc4745503889cbb8fe510..349109b2130e48615d8753dd91f07941f31146ff 100644 (file)
@@ -61,7 +61,6 @@
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
-#include <stdarg.h>
 #include <string.h>
 #include <ctype.h>
 #include <assert.h>
 #include <string.h>
 #include <ctype.h>
 #include <assert.h>
@@ -812,6 +811,18 @@ int BIO_printf (BIO *bio, const char *format, ...)
        {
        va_list args;
        int ret;
        {
        va_list args;
        int ret;
+
+       va_start(args, format);
+
+       ret = BIO_vprintf(bio, format, args);
+
+       va_end(args);
+       return(ret);
+       }
+
+int BIO_vprintf (BIO *bio, const char *format, va_list args)
+       {
+       int ret;
        size_t retlen;
 #ifdef USE_ALLOCATING_PRINT
        char *hugebuf;
        size_t retlen;
 #ifdef USE_ALLOCATING_PRINT
        char *hugebuf;
@@ -819,8 +830,6 @@ int BIO_printf (BIO *bio, const char *format, ...)
        MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */
 #endif
 
        MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */
 #endif
 
-       va_start(args, format);
-
 #ifndef USE_ALLOCATING_PRINT
        hugebuf[0]='\0';
        dopr(hugebuf, sizeof(hugebuf), &retlen, format, args);
 #ifndef USE_ALLOCATING_PRINT
        hugebuf[0]='\0';
        dopr(hugebuf, sizeof(hugebuf), &retlen, format, args);
@@ -838,7 +847,6 @@ int BIO_printf (BIO *bio, const char *format, ...)
                }
        CRYPTO_pop_info();
 #endif
                }
        CRYPTO_pop_info();
 #endif
-       va_end(args);
        return(ret);
        }
 
        return(ret);
        }
 
@@ -849,10 +857,21 @@ int BIO_printf (BIO *bio, const char *format, ...)
 int BIO_snprintf(char *buf, size_t n, const char *format, ...)
        {
        va_list args;
 int BIO_snprintf(char *buf, size_t n, const char *format, ...)
        {
        va_list args;
+       int ret;
+
+       va_start(args, format);
+
+       ret = BIO_vsnprintf(buf, n, format, args);
+
+       va_end(args);
+       return(ret);
+       }
+
+int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
+       {
        size_t retlen;
        int truncated;
 
        size_t retlen;
        int truncated;
 
-       va_start(args, format);
        _dopr(dopr_outch, dopr_isbig, dopr_copy,
                &buf, &n, &retlen, &truncated, format, args);
        if (truncated)
        _dopr(dopr_outch, dopr_isbig, dopr_copy,
                &buf, &n, &retlen, &truncated, format, args);
        if (truncated)
index 76748e05d8eb18b25a4743af7ea65aaffe7e3bda..c7273932e716e8722dc4bbdb17340851f406e04f 100644 (file)
@@ -62,6 +62,7 @@
 #ifndef NO_FP_API
 # include <stdio.h>
 #endif
 #ifndef NO_FP_API
 # include <stdio.h>
 #endif
+#include <stdarg.h>
 
 #include <openssl/crypto.h>
 
 
 #include <openssl/crypto.h>
 
@@ -600,7 +601,9 @@ void BIO_copy_next_retry(BIO *b);
 long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
 
 int BIO_printf(BIO *bio, const char *format, ...);
 long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
 
 int BIO_printf(BIO *bio, const char *format, ...);
+int BIO_vprintf(BIO *bio, const char *format, va_list args);
 int BIO_snprintf(char *buf, size_t n, const char *format, ...);
 int BIO_snprintf(char *buf, size_t n, const char *format, ...);
+int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes