From 15b5d84f9da2ce4bfae8580e56e34a859f74ad71 Mon Sep 17 00:00:00 2001 From: markus <> Date: Thu, 5 Sep 2002 12:51:50 +0000 Subject: import openssl-0.9.7-beta1 --- src/lib/libcrypto/err/err_prn.c | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'src/lib/libcrypto/err/err_prn.c') diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c index ecd0e7c4fa..c156663f0e 100644 --- a/src/lib/libcrypto/err/err_prn.c +++ b/src/lib/libcrypto/err/err_prn.c @@ -57,51 +57,51 @@ */ #include -#include "lhash.h" -#include "crypto.h" +#include +#include #include "cryptlib.h" -#include "buffer.h" -#include "err.h" -#include "crypto.h" +#include +#include +#include -#ifndef NO_FP_API -void ERR_print_errors_fp(fp) -FILE *fp; +void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), + void *u) { unsigned long l; - char buf[200]; - char *file,*data; + char buf[256]; + char buf2[4096]; + const char *file,*data; int line,flags; unsigned long es; es=CRYPTO_thread_id(); while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) { - fprintf(fp,"%lu:%s:%s:%d:%s\n",es,ERR_error_string(l,buf), - file,line,(flags&ERR_TXT_STRING)?data:""); + ERR_error_string_n(l, buf, sizeof buf); + BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, + file, line, (flags & ERR_TXT_STRING) ? data : ""); + cb(buf2, strlen(buf2), u); } } -#endif -void ERR_print_errors(bp) -BIO *bp; +#ifndef OPENSSL_NO_FP_API +static int print_fp(const char *str, size_t len, void *fp) { - unsigned long l; - char buf[256]; - char buf2[256]; - char *file,*data; - int line,flags; - unsigned long es; + return fprintf((FILE *)fp, "%s", str); + } +void ERR_print_errors_fp(FILE *fp) + { + ERR_print_errors_cb(print_fp, fp); + } +#endif - es=CRYPTO_thread_id(); - while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) - { - sprintf(buf2,"%lu:%s:%s:%d:",es,ERR_error_string(l,buf), - file,line); - BIO_write(bp,buf2,strlen(buf2)); - if (flags & ERR_TXT_STRING) - BIO_write(bp,data,strlen(data)); - BIO_write(bp,"\n",1); - } +static int print_bio(const char *str, size_t len, void *bp) + { + return BIO_write((BIO *)bp, str, len); + } +void ERR_print_errors(BIO *bp) + { + ERR_print_errors_cb(print_bio, bp); } + -- cgit v1.2.3-55-g6feb